转载  Struts2页面中访问Servlet/JSP作用域对象 收藏

一般的,在JSP页面中访问Servlet/JSP作用域对象,可以使用Java脚本或EL表达式,在Struts2中,还可以使用OGNL表达式访问包括Application scope attributes, Session scope attributes, Request scope attributes, Request parameters and framework Context scope parameters:

Application Scope Attribute

  1. <s:property value="%{#application.myApplicationAttribute}" />  

Session Scope Attribute

  1. <s:property value="%{#session.mySessionAttribute}" />  

Request Scope Attribute

  1. <s:property value="%{#request.myRequestAttribute}" />  

Request Parameter

  1. <s:property value="%{#parameters.myParameter}" />  

Context Scope Parameter

  1. <s:property value="%{#myContextParam}" />  

最后一个没有对应的EL访问方式,上面每个语句中去掉百分号和大括号也是可以的。

 

发表于 @ 2008年04月02日 15:19:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:Instructional Technology Notes at random | 新一篇:test

  • 发表评论
  • 评论内容:
  •  
Copyright © ahxiangf
Powered by CSDN Blog