JSP XML CheatSheet

来源:百度文库 编辑:神马文学网 时间:2024/04/29 02:10:50
JSP 2.0 XML Cheat Sheet
Copyright (c) 2005 NDP Software. Some Rights Reserved.
General
Use int i=0; (instead of <%!) Use int i=0; (instead of <%=) Use if (... (instead of <% )
SCOPE="page|request|session|application"
JSTL
Tag or JSP Files
Tag Files Only
Page Only
Scriptlets
javax.servlet.jsp.PageContextpageContext PagefindAttribute, getAttribute, getAttributesScope, getAttributeNamesInScope, setAttribute javax.servlet.jsp.JspWriterout Pageclear, clearBuffer, flush, getBufferSize, getRemaining javax.servlet.ServletConfigconfig PagegetInitParameter, getInitParameterNames java.lang.Throwableexception PagegetMessage, getLocalizedMessage, printStackTrace, toString java.lang.Objectpage Page  javax.servlet.ServletResponseresponse Page  javax.servlet.ServletRequestrequest Request getAttribute, getParameter, getParameterNames, getParameterValues, setAttribute javax.servlet.http.HttpSessionsession SessiongetAttribute, getId, setAttribute javax.servlet.ServletContextapplication ApplicationgetAttribute, getMimeType, getRealPath, setAttribute
EL
operations and | && | or | || | ‘+‘ | ‘-‘ | * | / | div | % | mod | gt | lt | ge | le | ==| eq | ne {‘-‘| ! | not | empty} pageContext The context for the JSP page. Provides access to various objects, including servletContext, session, request, and response. pageScope Maps page-scoped variable names to their values. requestScope Maps request-scoped variable names to their values. sessionScope Maps session-scoped variable names to their values. applicationScope Maps application-scoped variable names to their values. param Maps a request parameter to a single String parameter value (obtained by calling ServletReqwuest.getParameter(String name)). paramValues Maps a request parameter name to an array of String values for that parameter name (obtained by calling ServletRequest.getParameterValues(String name)). header Maps a request header name to a single String header value (obtained by calling ServletRequest.getHeader(String name)). headerValues Maps a request header name to an array of String values for that header (obtained by calling ServletRequest.getHeaders(String)). coookie Maps a cookie name to a single Cookie object. Cookies are retrieved according to the semantics of HttpServletRequest.getCookies(). If same name is shared by multiple cookies, an implementation must use the first encountered in the array of Cookie objects returned by the getCookies() method. However, the ordering of cookies currently unsspecified in the Servlet specification. initParam Maps a context initialization parameter name to a String parameter value (obtained by calling ServletContext.getInitparameter(String name)).
boolean fn:contains(string, substring) boolean fn:containsIgnoreCase(string, substring) boolean fn:startsWith(string, prefix) boolean fn:endsWith(string, suffix) String[] fn:split(string, separator) String fn:substring(string, begin, end) String fn:substringBefore(string, substring) String fn:substringAfter(string, substring) String fn:replace(string, before, after) String fn:toLowerCase(string) String fn:toUpperCase(string) String fn:trim(string) int fn:indexOf(string, suffix) int fn:length(String or Collection) String fn:join(String[], separator) String fn:escapeXml(string)

This work is licensed under aCreative Commons Attribution-NonCommercial-NoDerivs 2.5 License.