javaprepare: JSP tutorial - JSP Declaration
SCWCD home | SCWCD questions | SCWCD links | SCJP home
javaprepare.com: JSP tutorial - JSP Declaration
SCWCD home | SCWCD questions | SCWCD links | SCJP home
The JSP declaration scripting begin with <%! and end with %>. Variables declared in JSP declaration may be used in expressions or scriptlets.
The XMP syntax for declaration is <jsp:declaration>...</jsp:declaration>
The example below illustrates a few variants of JSP declarations.
<%! int i; %>
<%! String str="hello world"; int y=0; %>
<%! boolean flag=true; %>
<%! Boolean flagClass=new Boolean(true); %>
|
All examples above declare variables. They do not print any thing on the web page. A scriptlet or an expression can be used to access variables declared in JSP expression.
Similar to variable declaration, method declaration may also be included within JSP declarations.
|