valuestack

SSH框架中不为人知的细节(二)

隐身守侯 提交于 2019-11-30 07:50:05
Struts2之ValueStack 上一节在将阐述ModelDriven的机制时,常常提到一个名词ValueStack。也许你会毫不犹豫脱口而出,不就是值栈吗?对,就是它,那你知道Struts为什么需要引入它?它是如何工作的?它和OGNL有何私情?如果你对以上问题的答案很模糊,但是又确实想知道答案,那么本文将带你去看看ValueStack的世界。 Why ValueStack? 说Struts就不得不提MVC,所有的请求都是基于页面(View)提交,页面是数据最初的载体,然后提交给Controller,由Controller将数据做第一次处理,然后交给业务层做进一步的处理。下面,我们还是通过代码直观的体会一下。 JSP页面伪码: <form action="xxx/user-add.action" method="post"> username:<input type="text" name="username" /> age:<input type="text" name="age" /> groupName:<input type="text" name="group.name" /> <input type="submit" name="submit" value="添加" /> </form> VO伪码: public class UserVO { private

Interceptor can't access Action Parameters

大憨熊 提交于 2019-11-28 02:05:12
问题 I'm creating an example for struts2 interceptors. I created a simple login page and used a custom interceptor class to encrypt the input. But the interceptor is reading the values of input from ValueStack as null . I don't understand what am I doing wrong. I suppose struts.xml and interceptor class are enough data for this. If you need some more of my code, please tell. struts.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts

struts select tag with values of a array list

↘锁芯ラ 提交于 2019-11-27 09:48:16
I am developing a simple struts application. In my JSP I have a dropdown list box (using s:select tag). I need to fill the values with a arraylist values in the action class. How can I do that? what changes needed in the structs.xml file for complete this? JSP: <s:select name="department" label="" list="departmentlist" headerKey="-1" headerValue="Select Department"> Action class: private List<String> departmentlist = new ArrayList<String>(); public String xyz() { departmentlist.add("aaa"); departmentlist.add("bbb"); departmentlist.add("ccc"); departmentlist.add("ddd"); return "success"; } The

struts select tag with values of a array list

為{幸葍}努か 提交于 2019-11-26 17:52:26
问题 I am developing a simple struts application. In my JSP I have a dropdown list box (using s:select tag). I need to fill the values with a arraylist values in the action class. How can I do that? what changes needed in the structs.xml file for complete this? JSP: <s:select name="department" label="" list="departmentlist" headerKey="-1" headerValue="Select Department"> Action class: private List<String> departmentlist = new ArrayList<String>(); public String xyz() { departmentlist.add("aaa");