How to pass javascript variable in a method in javabean.

Posted on 2004-11-24
Last Modified: 2008-02-01
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,
Question by:sdushyanth
    1 Comment
    LVL 7

    Accepted 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 */

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    child constructor and parent constructor, overriding and overloading 6 60
    wefewf 2 28
    bigHeights  challenge 13 43
    pairs challenge 5 28
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now