I am creating a form using multiple inputs and submit by using jquery serialization method. When I submit form, the serialized form data is sent to server. The server receive using getter and setter but it does not work. I didn't receive any data from getter and setter. All variables is null and when I use the following code, I received the required String array.
HttpServletRequest req = ServletActionContext.getRequest();
req.getParameterMap().get("areacode[]");// this data is sent by jquery serialization method
req.getParameterMap().get("phonenumber[]");
and when I use the url like :
http://localhost:8080/PrivateSchool/saveStudent?studentname=John&clsid=1&city=NewYork&street=Street&homeno=45&username=john&password=john&role=student&areacode=89&phonenumber=122121212&areacode=90&phonenumber=789797878
it can receive by using getter and setter:
public String[] getAreacode() {
return areacode;
}
public void setAreacode(String[] areacode) {
this.areacode = areacode;
}
public String[] getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String[] phonenumber) {
this.phonenumber = phonenumber;
}
I just like using getter and setter, don't like getting from servlet request using getParameterMap() method. How could I do that? Why sent parameter's key is like areacode[] instead of areacode. pls!