Action Elements
时间:2008-08-05 来源:zyme007
A JSP action is executed when a JSP page is requsted.In other words,JSP action elements represent dynamic actions that take place at runtime,as opposed to JSP directives that are used only during the translation phase.Action elements,or tags as they are often called,are grouped into libraries(known as tag libraries).
Actions can be grouped into three categories:standard,custom,and JSP Standard Tag Library.
1、Standard actions
Standard actions are actions defined by JSP specification itself.The JSP standard actions use the prefix 'jsp'.
2、JSP Standard Tag Library
Core
Conditional processing and looping, importing data from external sources, etc.
XML processing
Processing of XML data, such as transforming and accessing individual elements
Internationalization (I18N) and formatting
Format and parse localized information, insert localized information in a page
Relational database access (SQL)
Read and write relational database data
3、custom actions
The JSP specification also defines how to develop new actions that can be used in any JSP page.Such actions are called custom actions.
4、The JSP Expression Language
An EL expression always starts with the '${' and ends with '}'.for example
1 + 2 + 3 = ${1 + 2 + 3}
A set of EL implicit variables,listed below ,provides access to all information about a request as well as other generic information.
here's a <c:out> action with an EL expression that uses the implicit param variable to read the value of a request parameter named userName:
<c:out value="${param.userName}" />
Actions can be grouped into three categories:standard,custom,and JSP Standard Tag Library.
1、Standard actions
Standard actions are actions defined by JSP specification itself.The JSP standard actions use the prefix 'jsp'.
Action element |
Description |
<jsp:useBean> | Makes a JavaBeans component available in a page |
<jsp:getProperty> | Gets a property value from a JavaBeans component and adds it to the response |
<jsp:setProperty> | Set a JavaBeans property value |
<jsp:include> | Includes the response from a servlet or JSP page during the request processing phase |
<jsp:forward> | Forwards the processing of a request to a servlet or JSP page |
<jsp:param> | Adds a parameter value to a request handed off to another servlet or JSP page using <jsp:include> or <jsp:forward> |
<jsp:plugin> | Generates HTML that contains the appropriate browser-dependent elements (OBJECT or EMBED) needed to execute an applet with the Java Plugin software |
<jsp:attribute> | Sets the value of an action attribute based on the body of this element |
<jsp:body> | Sets the action element body based on the body of this element. Required when the action element body contains <jsp:attribute> action elements |
<jsp:element> | Dynamically generates an XML element, optionally with attributes and a body defined by nested <jsp:attribute> and <jsp:body> actions |
<jsp:text> | Used to encapsulate template text that should be used verbatim; typically only needed in JSP pages written as XML documents |
2、JSP Standard Tag Library
Core
Conditional processing and looping, importing data from external sources, etc.
XML processing
Processing of XML data, such as transforming and accessing individual elements
Internationalization (I18N) and formatting
Format and parse localized information, insert localized information in a page
Relational database access (SQL)
Read and write relational database data
3、custom actions
The JSP specification also defines how to develop new actions that can be used in any JSP page.Such actions are called custom actions.
4、The JSP Expression Language
An EL expression always starts with the '${' and ends with '}'.for example
1 + 2 + 3 = ${1 + 2 + 3}
A set of EL implicit variables,listed below ,provides access to all information about a request as well as other generic information.
Variable name |
Description |
pageScope | A collection (a java.util.Map) of all page scope variables |
requestScope | A collection (a java.util.Map) of all request scope variables |
sessionScope | A collection (a java.util.Map) of all session scope variables |
applicationScope | A collection (a java.util.Map) of all application scope variables |
param | A collection (a java.util.Map) of all request parameter values as a single String value per parameter |
paramValues | A collection (a java.util.Map) of all request parameter values as a String array per parameter |
header | A collection (a java.util.Map) of all request header values as a single String value per header |
headerValues | A collection (a java.util.Map) of all request header values as a String array per header |
cookie | A collection (a java.util.Map) of all request cookie values as a single javax.servlet.http.Cookie value per cookie |
initParam | A collection (a java.util.Map) of all application initialization parameter values as a single String value per value |
pageContext | An instance of the javax.servlet.jsp.PageContext class, providing access to various request data |
相关阅读 更多 +