x

JSP Declaration

PREV     NEXT

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 Jsp declaration is <jsp:declaration>…</jsp:declaration>

 syntax for a 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.

PREV     NEXT



Like it? Please Spread the word!