Java Spring MVC How to get this set value? -
how value has been set method? how pass value post method? should declare global variable?
edit: want doing on method , display textbox on jsp if setdisplaybox = true. when user post form, setdisplaybox should true , return same jsp without redirect
@requestmapping(method = requestmethod.get) public string getsuccess(modelmap model, @modelattribute("user") user user, httpservletrequest request) { string boxdisplay = "true"; user.setdisplaybox(boxdisplay); return "success"; } @requestmapping(method = requestmethod.post) public string resetpassword(httpservletrequest request, modelmap model, @modelattribute("user") user user, modelmap modelmap) { user.setdisplaybox(user.getdisplaybox()); //how value has been set above? return "success"; }
set global variable user.
private user useraccount; @requestmapping(method = requestmethod.get) public string getsuccess(modelmap model, @modelattribute("user") user user, httpservletrequest request) { string boxdisplay = "true"; user.setdisplaybox(boxdisplay); useraccount = user; //load user in global var return "success"; } @requestmapping(method = requestmethod.post) public string resetpassword(httpservletrequest request, modelmap model, @modelattribute("user") user user, modelmap modelmap) { user.setdisplaybox(useraccount.getdisplaybox()); useraccount = null; //reset make sure loading user later. return "success"; }
Comments
Post a Comment