【发布时间】:2016-12-30 02:32:07
【问题描述】:
在服务器中,我有一个这样的 bean:
@Data
public class TechInfo {
private int shopID;
private String name;
private int experience;
TechnicianTitleInfo technicianTitleInfo;
private String skill;
}
如何在 Struts2 中获取请求参数?
我在操作中声明了一个 TechInfo,但在 Struts2 解析后它的值为 null。
动作是这样的:
public class AjaxAction{
@Getter @Setter private TechInfo techInfo;
protected void jsonExecute() throws Exception {
//need the techInfo
}
}
【问题讨论】:
-
jsonExecute()是哪个方法,在哪里调用(显然不是动作方法,因为它是void)?您能否显示用于此调用的拦截器堆栈,以及可能包含参数的 JSP sn-p 吗? -
@yonney.yang 您使用错误的参数名称来填充操作属性,要么更改名称,要么手动检索参数。
标签: java struts2 parameter-passing httprequest getter-setter