The JSP actions can be escaped using.
JSP whitespace is copied to the output directly, unless escaped.
In Resin 1.2, if you place a backslash immediately after a JSP action and before a line end, Resin will omit the end of line. In the following example, Resin keeps the whitespace after theand removes it after after the .
Sets a JSP directive
Prints the value of language.evaluated the page's
The expression action is equivalent to the following:
It also has the following XML equivalent
The following simple example just prints the value of a form variable.
Executes the statements in language.using the page's
The implicit variables, such as the request object and the out writer.is any statement list in the language, e.g. Java. The scriptlet can use any of the
Scriptlets have the following XML equivalent
Addscode to the Servlet class
JSP places the declaration code in the servlet class. In contrast, scriptlet and expression code are in a service method. So declarations can declare class variables and methods.
Declarations have the following XML equivalent
Includes the contents of the local URL atduring runtime.
jsp:include is a runtime action. It will call the includedjust as if its own HTTP request. The result of that page will be included in the current page.
is relative to the current page. Its root is the root of the application.
For compile-time includes, use <%@ include file='path'%>
Forwards the request to another page, i.e. an internal redirect.
If the page has already written some output, jsp:request will clear the output buffer.
is relative to the current page.
Creates a new bean and variable for the page.
jsp:useBean enables a popular style JSP page creation where Java Beans calculate the content, and JSP formats the presentation.
jsp:useBean creates an initializes a JSP bean for the page. The scope attribute determines the bean lifetime. For example, a session bean will be created once in a session.
jsp:useBean assigns the bean to the variable. It will also store the bean in the appropriate scope variable. For example, an application bean "foo" will be stored in the application variable.
jsp:useBean can also initialize beans. When jsp:useBean creates a new bean, it will execute the JSP in the jsp:useBean tag.
Roughly, JSP makes the following translation:
Prints a bean property.
jsp:getProperty converts property names following the bean standards.
Roughly, jsp:getProperty makes the following conversion:
Sets a bean property to.
If value is a runtime attribute, the bean property gets the expression value. If it's a static string, the value is first converted to the argument type and then set.
Sets a bean property to a parameter value.
The second form of jsp:setProperty lets scripts easily set Bean properties to form values.