Interview Question in JSP


 

Interview Question :: What is a Expression?

 What is a Expression?

by ksk
VoteNowAnswers to "What is a Expression?"

 An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like

<%= someexpression %> 
<%= (new java.util.Date()).toLocaleString() %>
You cannot use a semicolon to end an expression
by ksk

Expression:

Syntax of JSP Expressions are:

  <%="Any thing"   %>

JSP Expressions start with 

Syntax of JSP Scriptles are with <%= and ends with  %>. Between these this you can put anything and that will converted to the String and that will be displayed.

Example:
  <%="Hello World!" %>
Above code will display 'Hello World!'.
 

by ksk