May 2001
Intermediate to advanced
1088 pages
30h 13m
English
So far, you have seen how to insert Java statements and Java expressions into your code. In case you haven't realized it yet, all the code within the <% %> tags and all the expressions within the <%= %> tags belong to one big Java method in the generated servlet. That is why you can use the <%= %> tags to display a variable that was declared inside the <% %> tags.
You might want to put an entire Java method into a JSP. If you try to declare a method within the <% %> tags, the Java compiler reports an error. It won't let you declare a method within another method.
Use the <%! %> tags to enclose any declarations that belong outside the big method that generates the page. Listing 14.8 shows a JSP file ...
Read now
Unlock full access