In server,I have a bean like this:
@Data
public class TechInfo {
private int shopID;
private String name;
private int experience;
TechnicianTitleInfo technicianTitleInfo;
private String skill;
}
How can I get the request params in Struts2 ?
I've declared a TechInfo in my action, but its value is null after Struts2 parsed it.
The action is like this:
public class AjaxAction{
@Getter @Setter private TechInfo techInfo;
protected void jsonExecute() throws Exception {
//need the techInfo
}
}
The correct parameter format is the one using the Dot Notation :
techInfo.picID
techInfo.name
techInfo.technicianTitleInfo.titleId
and so on.
How to get the param which content-type is x-www-form-urlencoded
Struts2 is using request.getParameterMap()
.
I've declared a TechInfo in my action, but its value is null after Struts2 parsed it.
The value is null
because TechInfo
isn't bound to the action class variable. Request parameter name should be the same as variable name techInfo
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.