| Author |
passing the selected value back to calling page
|
carina caoor
Ranch Hand
Joined: Jun 23, 2007
Posts: 300
|
|
hi i am writing a servlet which takes data from the database on certain criteria and prints the output in a new window and the user can select one of the value from the output and on selecting a value from output the this selected value should pass to the main page which calls this servlet. eg. my html page which calls the sevlet is <html> <FORM ACTION="http://localhost:8080/MyPlots/Getcode"> <input type=text id=sacode READONLY> </html> and my servlet is Statement stmt = d.connection.createStatement(); ResultSet rs; rs = stmt.executeQuery("select areacode from areacodemaster"); out.println( "<table>" ); while ( rs.next() ) { String areacode = rs.getString(1); out.println("<tr><td>"+areacode+"</td></tr>"); } out.println( "</table>" ); d.connection.close(); now i want the areacodes given out in pop up window as output can be selected by the user and on selection the selected areacode should be displayed in the input text field of the html page. [ August 23, 2008: Message edited by: Bear Bibeault ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
For that you will need JavaScript.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
carina caoor
Ranch Hand
Joined: Jun 23, 2007
Posts: 300
|
|
Yeah i did write the javascript function function popuponclick() { my_window = window.open("http://localhost:8080/MyPlots/GetAreacode", "mySelect", "status=1,width=450,height=450,resizable=no,top=150"); //enableDisable(); } in the html that on clicking of buttob calls the servlet and the output is now in a pop up window but i am unable to pass the selected value back to the text field in html, how do i make the values inside the pop up selectable and how do i pass it back to html(the one that is calling this servlet) page, any code examples please..
|
 |
carina caoor
Ranch Hand
Joined: Jun 23, 2007
Posts: 300
|
|
In my servlet the output is radio button and when a user select the radio button i want to pass the selected value to the html text field ...any idea how to do this? please help it out.... Statement stmt = d.connection.createStatement(); ResultSet rs; rs = stmt.executeQuery("select distinct areacode from areacodemaster"); out.println( "<div STYLE='background:#f3f8f9;overflow:auto;height:400'><table>" ); while ( rs.next() ) { String areacode = rs.getString(1); out.println("<tr><td><input type='radio' name='areacoderadio' value='"+areacode+"'>"+areacode+"</td></tr>"); } out.println( "</table></div>" ); out.println(); d.connection.close();
|
 |
carina caoor
Ranch Hand
Joined: Jun 23, 2007
Posts: 300
|
|
|
i could solve it by employing the child window and parent window mechanism.
|
 |
 |
|
|
subject: passing the selected value back to calling page
|
|
|