Expression is used to insert the value of a java language expression. Expression values are converted into String object and would be put into the implicit out object.
JSP Expression Syntax
<%= scripting-language-expression %>
JSP Expression Sample Program (github)
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ourownjava.com</title> </head> <body> <% final String who; who = request.getParameter("who"); %> <h4>Hello <%= who %>!</h4> </body> </html>
How to run JSP Expression Sample Program
http://localhost:8080/jsp-play-ground/jsp-expressions-example.jsp?who=ourownjava.com