• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

passing the selected value back to calling page

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For that you will need JavaScript.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i could solve it by employing the child window and parent window mechanism.
reply
    Bookmark Topic Watch Topic
  • New Topic