JSP | Expression tag (original) (raw)

Last Updated : 14 May, 2026

The Expression Tag in JSP is used to display output directly on the client’s browser. It allows embedding Java expressions inside a JSP page and automatically converts them into string output. This tag simplifies printing data without writing explicit output statements.

**Syntax:

<%= expression %>

Difference from Scriptlet Tag

**Example

html `

<%= GeeksforGeeks %>

`

**Explanation: In this example, the string "Welcome to GeeksforGeeks" will be printed directly in the client's browser.

**Output

out

output

Implementation of JSP Expression Tag

Step 1: Create Dynamic Web Project

**Step 2: Create index.html.

This HTML file takes the username from the user and sends it to Geeks.jsp on form submission

HTML `

Enter Username:

`

**Output:

output

output

Step 3: Create JSP File

Here we are creating a jsp file names as Geeks.jsp

HTML `

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

Insert title here <%= String name=request.getParameter("username"); out.print("Hello "+name); %>

`

**Explanation:

If user enters Geeks, it displays: Hello Geeks!

**Output:

output

output