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
          主站蜘蛛池模板: 巧家县| 丹东市| 焦作市| 汉阴县| 建阳市| 西安市| 塔河县| 沂南县| 九寨沟县| 崇明县| 静安区| 台湾省| 凉山| 大同市| 方正县| 乌兰察布市| 神农架林区| 兴文县| 德江县| 临桂县| 洛宁县| 丽水市| 绥中县| 托克逊县| 库车县| 凤山市| 志丹县| 三明市| 高尔夫| 博兴县| 栾城县| 尼木县| 临沂市| 井研县| 高邑县| 西乌珠穆沁旗| 图片| 镇江市| 龙江县| 六安市| 招远市|