If you want to use javascript, the best way would be to generate a
javascript function in your first servlet which is called upon clicking
appropriate link in your first page. You can have some hidden input values
in your form which can be dynamically set by the javascript function (based
on the radio button/option selected). The javascript function should submit
the form after setting the hidden values, then your servlet can use these
hidden values as parameters to bulid your  sql query (you will have to use
JDBC PreparedStatement or callableStatement).

Whether to use a single servlet or two servlets to generate the two pages is
a matter of design.
If you want to use the same servlet, you must have appropriate  request
parameter to specify the action. Your servlet can take app. action based on
the value of this parameter.

Hope this helps
Anil

-----Original Message-----
From: manoj kumar [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 16, 1999 1:49 AM
To: [EMAIL PROTECTED]
Subject: passing valuees from javascript to servlets


The scenario of my problem is:

Upon clicking a link in a HTML page, a servlet(say, A) is called, which in
turn fetches some rows from a database and returns the same to the browser
via dynamically generated HTML page. This dynamically HTML generated page
presents some options (radio buttons) to the user.
Upon, selecting a particular option, when the submit button is clicked, I
need that another servlet (say, B) be called (or may be the same
servlet(A)).This servlet B accees the databse a performs  a query on the
databse depending upon the option selected by the user in the previously
dynamically generated HTML page.
The query is something like this:

select col1 from abc where col2=value

The 'value ' in the above SQL statement is something which should correspond
to the option selected by the user.
How do I go about it?
Should I use 2 servlets or one would suffice.

An urgent response is highly appreciated.


Thanks in advance,



Manoj



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to