• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 480
  • Last Modified:

How to pass javascript variable in a method in javabean.

Hai everyone,
   I am using jsp,servlet and javabean in developing  my project,
i want to know how to pass java script variable in a method in java bean,there are two drop downboxes while selecting value in location drop down box ,doctor names in that location should come in  doctors drop down box for example  Locationbean a = new Locationbean();
     a.getLocation("java script variable ");
the design we are going at present is  posting it to the servlet and getting it back,
but i need to pass the javascript  value in getLocation() method,

any reply 's will be highly appreciated,
thank u,
1 Solution
Use the beans set method and pass it a request.getParameter("......"); as the value. Avoids using the JavaScript completely

String param = request.getParameter("XXX");         /* Name of textfield, option box or whatever etc within " " */
xxx.setXXX(param);                                                      /* The desired set Method in the bean */

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now