. syntax summary
| jsp element | syntax | interpretation | notes |
|---|---|---|---|
| jsp expression | <%= expression %> | expression is evaluated and placed in output. | xml equivalent is<jsp:expression>. predefined variables are request, response, out, session, application, config, and pagecontext (available in scriptlets also).
|
| jsp scriptlet | <% code %> | code is inserted in service method.
| xml equivalent is<jsp:scriptlet>.
|
| jsp declaration | <%! code %> | code is inserted in body of servlet class, outside of service method.
| xml equivalent is<jsp:declaration>.
|
jsp page directive
| <%@ page att="val" %> | directions to the servlet engine about general setup. | xml equivalent is<jsp:directive.page att="val"\>. legal attributes, with default values in bold, are:
|
jsp include directive
| <%@ include file="url" %> | a file on the local system to be included when the jsp page is translated into a servlet. | xml equivalent is<jsp:directive.include.the url must be a relative one. use the jsp:include action to include a file at request time instead of translation time.
|
| jsp comment | <%-- comment --%> | comment; ignored when jsp page is translated into servlet. | if you want a comment in the resultant html, use regular html comment syntax of <-- comment -->.
|
the jsp:include action
| <jsp:include
page="relative url"
flush="true"/>
| includes a file at the time the page is requested. | if you want to include the file at the time the page is translated, use the page directive with the include attribute instead. warning: on some servers, the included file must be an html file or jsp file, as determined by the server (usually based on the file extension).
|
the jsp:usebean action
| <jsp:usebean att=val*/> or<jsp:usebean att=val*>
| find or build a java bean. | possible attributes are:
|
the jsp:setproperty action
| <jsp:setproperty att=val*/> | set bean properties, either explicitly or by designating that value comes from a request parameter. | legal attributes are
|
the jsp:getproperty action
| <jsp:getproperty
name="propertyname"
value="val"/>
| retrieve and output bean properties. | |
the jsp:forward action
| <jsp:forward
page="relative url"/>
| forwards request to another page. | |
the jsp:plugin action
| <jsp:plugin
attribute="value"*>
...
</jsp:plugin>
| generates object or embed tags, as appropriate to the browser type, asking that an applet be run using the java plugin.
|