GeeCON Prague 2014*
The moose likes Struts and the fly likes set java variable using setter method from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "set java variable using setter method from jsp" Watch "set java variable using setter method from jsp" New topic
Author

set java variable using setter method from jsp

prajyot jadhav
Greenhorn

Joined: Dec 26, 2011
Posts: 6
i am taking one value form javascript and setting it to input element in jsp and i want to set this value to java variable... how can i do this..?
also suggest if its possible using doGet method since data to be sent is visible in browser address bar when request submitted..
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Bit confusing i'm thinking your approach was wrong. Can you please describe what you are doing?


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
prajyot jadhav
Greenhorn

Joined: Dec 26, 2011
Posts: 6
actually i am using struts, and taking one client specific value form javascript and setting that to JSP input element (say input type="text" name="NAME")
now i want to use that value in Action.java class which extends DispatchAction that we have in struts,

i tried to get that value using request.getParamter() in this class inside a method which has following signature

public ActionForward FunctionName (ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)
throws Exception {
....
JavaVariable=request.getParamter('NAME[i.e. mentioned in input tag of JSP ]')
.....
}

but request.getParamete() is returning null...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: set java variable using setter method from jsp