摘要:
采用基本类型接收请求参数(get/post)在Action类中定义与请求参数同名的属性,struts2便能自动接收请求参数并赋予给同名属性。请求路径: http://localhost:8080/test/view.action?id=78public class ProductAction { private Integer id; public void setId(Integer id) {//struts2通过反射技术调用与请求参数同名的属性的setter方法来获取请求参数值 this.id = id; } public ... 阅读全文
posted @ 2011-12-14 21:57
一直在等
阅读(767)
评论(0)
推荐(0)
摘要:
动态方法调用如果Action中存在多个方法时,我们可以使用!+方法名调用指定方法。如下:public class HelloWorldAction{ private String message; .... public String execute() throws Exception{ this.message = "我的第一个struts2应用"; return "success"; } public String other() throws Exception{ this.message = "第二个方法... 阅读全文
posted @ 2011-12-14 21:14
一直在等
阅读(556)
评论(0)
推荐(0)
浙公网安备 33010602011771号