渣渣渣

xiaoxiao2021-02-28  177

一个请求从前台到后台需要经过多个过滤器,有个是数据初始化的,会初始化一个map,和栈空间, 一个是ModelDriven(model对象参数匹配User u),一个是参数匹配用的(private String name+get.set), Servlet编程的时候后台获取前台对象就需要request.getparamters("XX"),此处struts已经需了封装,栈就是先进后出的, ActionContext.getContext().put("role", roleList),(1) 这样的写法就是将对象放到map中; ActionContext.getContext().getValueStack().push(r)(2) 这样的写法就是将对象放到栈中; 两者都可以将数据带到前台,现在说前台数据怎么取出; 今天看了一篇博客,上面讲解说 #role 相当于ActionContext.getContext("role"); (#相当于ActionContext.getContext()),我测试了一下,感觉挺对的,#role可认为是从map中取得对应的值; <s:iterator value="#role" > sruts的这个遍历则会将对像放置于 栈顶, 用法 <input type="text" value="<s:property value="introduct"/>">或者 <td>${introduct}</td>(EL表达式) 这个数据在栈的时候可以通过<td>${introduct}</td> (EL表达式<input type="text" value="${introduct}" name="introduct">)取得,EL取值范围:page,request,栈,map......

若有不对请指出。

转载请注明原文地址: https://www.6miu.com/read-31926.html

最新回复(0)