Sun River
          Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...
          posts - 78,comments - 0,trackbacks - 0

          pageContext - the PageContext object. Provides an API to access various objects including:

            • context - the context for the JSP page's servlet and any Web components contained in the same application.

            • session - the session object for the client.

            • request - the request triggering the execution of the JSP page.

          • pageScope - a java.util.Map that maps page-scoped attribute names to their values.

          • requestScope - a java.util.Map that maps request-scoped attribute names to their values.

          • sessionScope - a java.util.Map that maps session-scoped attribute names to their values.

          • applicationScope - a java.util.Map that maps application-scoped attribute names to their values.

          • param - a java.util.Map that maps parameter names to a single String parameter value (obtained by calling ServletRequest.getParameter(String name)).

          • paramValues - a java.util.Map that maps parameter names to a String[] of all values for that parameter (obtained by calling ServletRequest.getParameterValues(String name)).

          • header - a java.util.Map that maps header names to a single String header value (obtained by calling HttpServletRequest.getHeader(String name)).

          • headerValues - a java.util.Map that maps header names to a String[] of all values for that header.

          • cookie - a java.util.Map that maps cookie names to a single Cookie object. Cookies are retrieved according to the semantics of HttpServletRequest.getCookies(). If the same name is shared by multiple cookies, an implementation must use the FIRST one encountered in the array of Cookie objects returned by the getCookies() method. However, users of the cookie implicit object must be aware that the ordering of cookies is currently unspecified in the servlet specification.

          • initParam - a java.util.Map that maps context initialization parameter names to their String parameter value (obtained by calling ServletContext.getInitParameter(String name)).

          Examples:

          The request's URI (obtained from HttpServletRequest):

          ${pageContext.request.requestURI}
          					

          The value of the numberOfItems property of the session-scoped attribute named cart:

          ${sessionScope.cart.numberOfItems}
          					

          The context path:

          ${pageContext.request.contextPath}
          					

          The session-scoped attribute named 'profile' (null if not found):

          ${sessionScope.profile} 
          					

          The String value of the productId parameter, or null if not found:

          ${param.productId} 
          					

          The value of the productId request parameter:

          ${param["productId"]}
          					

          The String[] containing all values of the productId parameter, or null if not found:

          ${paramValues.productId} 
          					

          A collection's members can be accessed using square brackets as shown by retrieval of the userName parameter from the param object. Members of an array or List can be accessed if the value in square brackets can be coerced to an int.

          <html>
          	<head><title>Customer Profile for ${param["userName"]}</title></head>
          	<body>
          		...
          	</body>
          </html>
          
          					
          Maps can be accessed using the dot operator OR square brackets. For example, ${param.userName} is EQUIVALENT to ${param["userName"]}.

          The host HTTP attribute:

          ${header["host"]}
          					

          Here is an example of accessing a page-scoped object that is called pageColor:

          <body bgcolor="${pageScope.pageColor}"> 
          
          					
          it is equivalent to:
          <body bgcolor="${pageScope['pageColor']}">
          
          					

          posted on 2006-10-16 01:19 Sun River 閱讀(337) 評論(0)  編輯  收藏 所屬分類: Servlet & Jsp
          主站蜘蛛池模板: 苍溪县| 景宁| 宿松县| 岑巩县| 山东| 大埔县| 成安县| 乌兰浩特市| 辰溪县| 平远县| 湄潭县| 大姚县| 呼图壁县| 固镇县| 随州市| 将乐县| 土默特左旗| 利川市| 铁力市| 沽源县| 乌苏市| 五原县| 岐山县| 清新县| 女性| 洛扎县| 怀远县| 宜良县| 盱眙县| 商洛市| 开原市| 柘城县| 库尔勒市| 宁化县| 许昌县| 怀化市| 开阳县| 聂拉木县| 河北区| 兴隆县| 甘孜|