Struts2 用DomainModel接收参数
来源:互联网 发布:mysql在linux下安装 编辑:程序博客网 时间:2024/05/16 11:44
1、struts.xml
<struts> <constant name="struts.devMode" value="false" /> <constant name="struts.enable.DynamicMethodInvocation" value="true" /> <constant name="struts.i18n.encoding" value="utf-8"></constant> <package name="user" extends="struts-default"> <action name="user" class="com.wxh.action.UserAction" > <result >/useraddsuccess.jsp</result> </action> </package> </struts>
2、index.jsp
<body><form action="user!add" method="get"> 姓名:<input type="text" name="user.name"/><br> 年龄:<input type="text" name="user.age"/><br> <input type="submit" value="添加"> </form> </body>
3、UserAction.java
package com.wxh.action;import com.wxh.model.User; import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {private static final long serialVersionUID = 1L; private User user;public String add(){System.out.println("name="+user.getName());System.out.println("age="+user.getAge());return SUCCESS;}public User getUser(){return user;}public void setUser(User user){this.user=user;}}
4、User.java
package com.wxh.model;public class User {private String name;private int age;public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}}
0 0
- struts2用DomainModel接收参数
- struts2用DomainModel接收参数
- Struts2用DomainModel接收参数
- Struts2 用DomainModel接收参数
- struts2使用DomainModel接收参数
- Struts2_8_用DomainModel接收参数
- struts2 用DomainModel接受参数
- Struts2学习之Action接收参数方法二(用DomainModel接收参数(模型驱动))
- DomainModel接收参数
- 道听途说Struts2之8:使用DomainModel属性接收参数
- Struts2_08_利用DomainModel接收参数
- Strutus2中用DomainModel接收参数
- struts2的domainmodel接受参数
- Struts2中action接收参数的DomainModel、ModelDriven以及Preparable接口
- struts2 OGNL domainModel传参数问题
- (02)Structs初学笔记——用DomainModel接收参数
- DomainModel 接收参数 在js里怎么拿到该值
- Struts2 用ModelDriven接收参数
- java.rmi.UnmarshalException:errorunmarshalling return; java.lang.ClassNotFoundException的解决方法
- 如何让你的网络平台成为一个巨大磁场
- [leetcode] 43. Multiply Strings 解题报告
- 多态总结
- Elasticsearch Scroll (游标)API详解
- Struts2 用DomainModel接收参数
- DRP之旅(1)——Servlet初探
- 对于其中具体的流程,也是要掌握好
- 关联分析的FP-growth算法 in Python
- HM Fast Learning
- android下数据库的创建
- 外部链接锚文字包含关键词
- RMQ问题的4解决方案
- 网站概况分析可以认为是网站的“五官”检测