Expression element in the JSP <%= … %> Only one java expression Ex:
Index.jsp
----------
Welcome to JSP scripting elements
<%! int num1=10;
int num2=20;
int add;
%>
<% add=num1+num2 %>
Addition is<%= add %> <@!-- Expression tag -->
Because they're expressions, and not statements.
<%= add %>
is translated to
out.print(add);
So you really don't want a semicolon after the expression. It would lead to
out.print(add;);
which would not be valid Java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With