struts2中freemarker访问request session Application parameter对象
 struts2 freemarker request session parameter
 使用Request里的Attribute值最简单的方法就是直接${AttributeName}或者安全一点:${AttributeName!"default Value"}
3.取request范围的对象
${Request.myRequestAttribute}   或者 :   ${Request.myRequestAttribute!"default value"}   
 
4.取request parameter范围的对象
${Parameters.myParameter}   或者 : ${Parameters.myParameter!"default value"}   
 
5.取context parameter范围的对象
 ${stack.findValue('#myContextParam')}  
 
request 对象直接对应 HttpServletResponse
例如 获取 当前网页地址:  ${request.requestURL}
客户端IP地址:  ${request.getRemoteAddr()} 或者  ${request.remoteAddr}
提交方式:  ${request.method}
等等
 
Request: 用于获取Request对象中的attribute对象。
例如:${Request["myRequestAttribute"]} 这样是直接在页面输出属性值。相当于request.getAtrribute("myRequestAttribute");
         如果要对这个值进行判断就必须使用如下格式:<#if Request["myRequestAttribute"]="edit">
或者 : ${Request["myRequestAttribute"]!"default value"}   

Tags: Struts2  struts编程  freemarker  
分页:[«] 1[»]
分类最近文章
    <#CACHE_INCLUDE_CATEGORY__HTML#>
Powered By Z-Blog   STYLE by busfly . FatMouse
Copyright © 2007 巴士飞扬技术博客. . 沪ICP备07027972号. 会员群1(J2EE为主):3769186.