Java Reference
In-Depth Information
a value that can be displayed on a Web page. The tags commence with <%= and
end with %> .
<%= origPrice*(1+VAT) %>
<%= today.getMonth() %>
Not that, unlike declarations (and scriptlets below), an expression must not be
terminated with a semi-colon
Scriptlets are blocks of Java code that are to be executed when the JSP is called up.
It is possible to include large amounts of code via this method, but that would not be
good practice. As noted in Sect. 9.1 , such code should be kept to a minimum. It will
be seen in the latter part of the next chapter that the bulk of such processing may be
encapsulated within a JavaBean, the methods of which may then be called from the
JSP. Methods of the standard Java classes may also be called, of course. Scriptlets
tags commence with <% and end with %> .
//'total' and 'numArray' are pre-declared.
total = 0;
for (int i=0; i<numArray.length; i++)
<%= total %>
The value of any output may be varied according to whether a particular condi-
tion is true or not.
if today.getHours() < 12
Good morning!
Search WWH ::

Custom Search