Java 如何获取struts2中x-www-form-urlencoded的内容类型参数
请求如下: 在服务器中,我有这样一个bean:Java 如何获取struts2中x-www-form-urlencoded的内容类型参数,java,struts2,parameter-passing,httprequest,getter-setter,Java,Struts2,Parameter Passing,Httprequest,Getter Setter,请求如下: 在服务器中,我有这样一个bean: @Data public class TechInfo { private int shopID; private String name; private int experience; TechnicianTitleInfo technicianTitleInfo; private String skill; } public class AjaxAction{ @G
@Data
public class TechInfo {
private int shopID;
private String name;
private int experience;
TechnicianTitleInfo technicianTitleInfo;
private String skill;
}
public class AjaxAction{
@Getter @Setter private TechInfo techInfo;
protected void jsonExecute() throws Exception {
//need the techInfo
}
}
如何在Struts2中获取请求参数
我已经在我的操作中声明了一个TechInfo,但是在Struts2解析后它的值为null
行动是这样的:
@Data
public class TechInfo {
private int shopID;
private String name;
private int experience;
TechnicianTitleInfo technicianTitleInfo;
private String skill;
}
public class AjaxAction{
@Getter @Setter private TechInfo techInfo;
protected void jsonExecute() throws Exception {
//need the techInfo
}
}
正确的参数格式是使用点表示法的格式:
techInfo.picID
techInfo.name
techInfo.technicianTitleInfo.titleId
以此类推。正确的参数格式是使用点表示法的格式:
techInfo.picID
techInfo.name
techInfo.technicianTitleInfo.titleId
等等
如何获取x-www-form-urlencoded内容类型的参数
Struts2正在使用request.getParameterMap()
我已经在我的操作中声明了一个TechInfo,但是在Struts2解析后它的值为null
该值为null
,因为TechInfo
未绑定到action类变量。请求参数名称应与变量名称相同techInfo
如何获取x-www-form-urlencoded内容类型的参数
Struts2正在使用request.getParameterMap()
我已经在我的操作中声明了一个TechInfo,但是在Struts2解析后它的值为null
该值为
null
,因为TechInfo
未绑定到action类变量。请求参数名应该与变量名techInfo
相同,哪个方法是jsonExecute()
,在哪里调用它(显然不是操作方法,因为它是void
)?能否显示用于此调用的侦听器堆栈,以及可能包含参数的JSP代码段?@yonney.yang如果使用错误的参数名称来填充操作属性,请更改名称或手动检索参数。哪个方法是jsonExecute()
,在哪里调用(显然不是操作方法,因为它是void
)?您能否显示用于此调用的侦听器堆栈,以及可能包含参数的JSP代码段?@yonney.yang如果使用错误的参数名称填充操作属性,您可以更改名称或手动检索参数。