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 閱讀(329) 評論(0)  編輯  收藏 所屬分類: Servlet & Jsp
          主站蜘蛛池模板: 治县。| 上饶县| 那坡县| 黔西| 开化县| 柳江县| 宁陕县| 仙桃市| 万盛区| 峨眉山市| 丰顺县| 池州市| 灵武市| 衡阳县| 辽中县| 宣化县| 石嘴山市| 黔西县| 沽源县| 平乐县| 葫芦岛市| 丰台区| 常山县| 阳山县| 吉隆县| 芮城县| 德清县| 鹤壁市| 澄城县| 泊头市| 拜泉县| 罗源县| 卫辉市| 常州市| 尼玛县| 团风县| 长海县| 南开区| 噶尔县| 滕州市| 青冈县|