| JSP Elements |
MyNotes! |
| JSP Element | Syntax | Interpretation |
|---|---|---|
| Directives | ||
| JSP page Directive |
<%@ page att="val" %> |
Directions to the servlet engine about general setup. |
| JSP include Directive |
<%@ include file="url" %> |
A file on the local system to be included when the JSP page is translated into a servlet. |
| Tag Directive |
<%@ tag att="val" %> |
Similar to the page directive in a JSP page, but applies to tag files instead of JSP pages. |
| Taglib Directive | <%@ taglib att="val" prefix="tagPrefix" %> | Defines a tag library and prefix for the custom tags used in the JSP page. |
| Core Syntax | ||
| JSP Declaration |
<%! code %> |
Code is inserted in body of servlet class, outside of service method. |
| JSP Scriptlet |
<% code %> |
Code is inserted in service method. |
| JSP Expression |
<%= expression %> |
Expression is evaluated and placed in output. |
| JSP Comment |
<%-- comment --%> |
Comment; ignored when JSP page is translated into servlet. |
| The jsp:include Action |
<jsp:include |
Includes a file at the time the page is requested. |
| The jsp:useBean Action | <jsp:useBean att=val*/>
or <jsp:useBean att=val*> ... </jsp:useBean> |
Find or build a Java Bean. |
| The jsp:setProperty Action |
<jsp:setProperty att=val*/> |
Set bean properties, either explicitly or by designating that value comes from a request parameter. |
| The jsp:getProperty Action |
<jsp:getProperty |
Retrieve and output bean properties. |
| The jsp:forward Action |
<jsp:forward |
Forwards request to another page. |
| The jsp:plugin Action |
<jsp:plugin |
Generates OBJECT or EMBED tags, as appropriate to the browser type, asking that an applet be run using the Java Plugin. |