JSP expression tag

A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client using response object.

The syntax for an expression is as follows:
<%= scripting-language-expression %>

Example of JSP expression Tag :
On index.jsp, user enters name that send as request to user.jsp which prints username as output.

index.jsp
   <html>   
   <body>   
      <form action="user.jsp">   
        <input type="text" name="username">   
        <input type="submit" value="Submit"><br/>   
      </form>   
   </body>   
   </html>   

user.jsp
   <html>   
   <body>   
       <% ="Welcome! "+ request.getParameter("username") %>     
   </body>   
   </html>   

No comments: