struts2 用ModelDriven接收参数
来源:互联网 发布:python读取zip文件 编辑:程序博客网 时间:2024/06/05 17:11
index.jsp
<% String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><base href="<%=basePath %>"/><body> 使用ModelDriven接收参数<a href="user/user!add?name=a&age=8">添加用户</a></body>
user_add_success.jsp
<body>User Add Success!</body
struts.xml
<struts> <constant name="struts.devMode" value="true" /> <package name="user" extends="struts-default" namespace="/user"> <action name="user" class="com.bjsxt.struts2.user.action.UserAction"> <result>/user_add_success.jsp</result> </action> </package></struts>
package com.bjsxt.struts2.user.action;import com.bjsxt.struts2.user.model.User;import com.opensymphony.xwork2.ActionSupport;import com.opensymphony.xwork2.ModelDriven;public class UserAction extends ActionSupport implements ModelDriven<User>{private User user = new User();public String add() {System.out.println("name=" + user.getName());System.out.println("age=" + user.getAge());return SUCCESS;}@Overridepublic User getModel() {return user;}}
user.java
package com.bjsxt.struts2.user.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 用ModelDriven接收参数
- struts2 用ModelDriven接收参数
- Struts2_9_用ModelDriven接收参数
- 使用ModelDriven接收参数
- Struts2参数的接收 使用DomainObject和ModelDriven
- Struts2_0900_ModelDrivenParamInput 使用ModelDriven接收参数
- Action接收参数之---ModelDriven
- Struts2中action接收参数的DomainModel、ModelDriven以及Preparable接口
- DemanModle , ModelDriven与 Action属性接收参数
- 使用ModelDriven接收参数添加用户
- struts2用DomainModel接收参数
- struts2用DomainModel接收参数
- Struts2用DomainModel接收参数
- Struts2 用DomainModel接收参数
- struts2 中修改modelDriven的refreshModelBeforeResult参数
- 2、接收参数: ModelDriven接口接收参数和(常规)action的属性接收参数
- 用struts2接收三种参数
- struts2用action属性接收参数
- Eclipse Bugs
- poj1006 Biorhythms中国剩余定理
- 项目“No bean named 'shiroFilter' is defined”错误处理
- 第一站JavaWeb
- XML和XSTL、XMLHttpRequest 的介绍
- struts2 用ModelDriven接收参数
- tensorflow实现多层感知机
- JAVA基础
- springMVC组件
- java包装类
- iOS app 运行的时候和打包出来的app 不一样
- 文章标题
- 20170622 js回顾
- Redis和Memcached的区别