Struts中jsp和action中参数传递总结
来源:互联网 发布:朝鲜核问题的影响 知乎 编辑:程序博客网 时间:2024/06/05 16:16
1.jsp-------------->action传递参数
jsp: <input type=”text” name=”name” />
action: private String name; getName(); setName(String name);
---------------------------------------------------------
jsp: <input type=“text” name=”user.name” />
action: private User user; getUser(); setUser(User user);
-----------------------------------------------------------
jsp: <input type=”text” name=”name” />
action: request.getParameter("name");
-------------------------------------------------------------
jsp: <input type=“text” name=”name” />
action: extends ActionSupport implements ModelDriven<User>; getUser(); setUser(User user);
2. action------------------>jsp传递参数
action: private String name; getName();
jsp: ${name}/request.getParameter(“name”);
<s property value=”name” /> 或<s:property value="user.name"/>
---------------------------------------------------------------
action: ActionContext.getContext().put("key", "value");
jsp: <s:property value="#key"/>取值(非OGNL中root对象的值)
-------------------------------------------------------------------
action: ServletActionContext.getRequest().setAttribute("key", "value");
ServletActionContext.getRequest().getSession().setAttribute("key", "value");
ActionContext.getContext().getSession().put("key", "value");
jsp: <% request.getAttribute(“key”) %> / <s:property value=”key” />
-------------------------------------------------------------------------------------
ps: <% request.getAttribute(“key”) %> == <s:property value=”#key” />
3. action-------------->action传递参数
struts.xml: <result name="delete" type="redirectAction">
<param name="actionName">Send_messages</param>
<param name="type">success</param>
action: private String type; getType(); setType(String type)
4. jsp------------------->jsp传递参数
struts.xml: <result name="add" type="dispatcher">
<param name="location">/WEB-INF/jsp/succ.jsp?toUrl="user/list_user"</param>
jsp: ${param.toUrl}/request.getParameter("toUrl")
-------------------------------------------------------------
jsp1: href=”xx.jsp?toUrl=”user/list_user”
jsp2: ${param.toUrl}/request.getParameter("toUrl")
jsp: <input type=”text” name=”name” />
action: private String name; getName(); setName(String name);
---------------------------------------------------------
jsp: <input type=“text” name=”user.name” />
action: private User user; getUser(); setUser(User user);
-----------------------------------------------------------
jsp: <input type=”text” name=”name” />
action: request.getParameter("name");
-------------------------------------------------------------
jsp: <input type=“text” name=”name” />
action: extends ActionSupport implements ModelDriven<User>; getUser(); setUser(User user);
2. action------------------>jsp传递参数
action: private String name; getName();
jsp: ${name}/request.getParameter(“name”);
<s property value=”name” /> 或<s:property value="user.name"/>
---------------------------------------------------------------
action: ActionContext.getContext().put("key", "value");
jsp: <s:property value="#key"/>取值(非OGNL中root对象的值)
-------------------------------------------------------------------
action: ServletActionContext.getRequest().setAttribute("key", "value");
ServletActionContext.getRequest().getSession().setAttribute("key", "value");
ActionContext.getContext().getSession().put("key", "value");
jsp: <% request.getAttribute(“key”) %> / <s:property value=”key” />
-------------------------------------------------------------------------------------
ps: <% request.getAttribute(“key”) %> == <s:property value=”#key” />
3. action-------------->action传递参数
struts.xml: <result name="delete" type="redirectAction">
<param name="actionName">Send_messages</param>
<param name="type">success</param>
action: private String type; getType(); setType(String type)
4. jsp------------------->jsp传递参数
struts.xml: <result name="add" type="dispatcher">
<param name="location">/WEB-INF/jsp/succ.jsp?toUrl="user/list_user"</param>
jsp: ${param.toUrl}/request.getParameter("toUrl")
-------------------------------------------------------------
jsp1: href=”xx.jsp?toUrl=”user/list_user”
jsp2: ${param.toUrl}/request.getParameter("toUrl")
0 0
- Struts中jsp和action中参数传递总结
- struts的action 中向jsp中传递参数
- struts2框架中Action必须实现execute方法?和Struts参数传递
- struts1及struts2中action和jsp之间数据和参数传输传递
- struts1及struts2中action和jsp之间数据和参数传输传递
- JAVAEE中从JSP页面向Action传递中文参数
- 在Struts中Action传参数 [转总结]
- Struts配置文件中传递参数
- struts和jsp页面之间传递参数
- struts页面对象向action中传递
- Struts2中Action向JSP传递数据
- Struts2中Action间参数传递
- struts2中redirect action的参数传递
- Struts2中action传递时间参数
- form action中传递参数的问题
- Struts2中Action间参数传递
- Struts2中Action接收传递的参数
- form action中传递参数的问题
- Dom解析xml文件(3)
- 蘑菇街春招 - 编程题第二题 - 隐式图搜索 - 四个水杯
- 使用字符流复制文件
- Java基础篇
- Eclipse安装Activiti Designer插件,报错的解决办法
- Struts中jsp和action中参数传递总结
- 1003 entropy encoder
- poj 2186 Popular Cows 强联通分量tarjan/Kosaraju
- HashCode和equal方法
- Qt5之QRadioButton
- LeetCode 228 Summary Ranges
- C++之多态性与虚函数
- hadoop入门教程-hdfs
- HDU 4336 Card Collector