Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Rainhard Fischer   on Jul 17 In Java Category.

  
Question Answered By: Douglas Sullivan   on Jul 17

When you start the expression  with "<%=", you are
asking to print the result of the expression enclosed.
But "<%!" is used to declare member variables.
When you write a jsp, the web container converts it in
a java source class (.java) and then is compiled to a
.class .
All the "<%= expression %>" statements are replaced
with "out.print(expression)". But the "<%! expresion
%>" is copied directly in the body of the class, as
member variable for example.
Finally, if you use "<% expresion %>", the expression
is copied directly in the main method body, generally
called doService(HTTPRequest, HTTPResponse).
If you are using Tomcat, check out the
$CATALINA_HOME/work directory, here you can find the
generated classes, and look at the generated code.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on jsp declaration bug? Or get search suggestion and latest updates.


Tagged: