Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Popup windows with dynamic content using struts

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i just joined this forum. i have a doubt thats been bugging me for a while.
here goes:
i have a jsp, say A.jsp. there is a text field that needs to be filled with some data. the user has an option to click on a browse button, on which a popup window must open. this is B.jsp. B.jsp has some data in it. When the user select a radio button in B.jsp and clicks the OK button, the popup must close and the number(ID) attached to the radio button must fill the text field in A.jsp. Please help. Thanx in advance.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not put the field values etc in the Request and get them from there for the various pages?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most efficient way to do this is with javascript. When the "OK" button is clicked on the popup window, do the follwing in your javascript code:

  • Get a reference to the opening window using window.opener.
  • Get a reference to the text field within the opening window
  • find the value of the checked option by looping through the radio button controls and using the "checked" property to know which one was checked.
  • set the value of the text field in the opening window to the value of the checked radio button.
  • close the popup window using window.close()


  • Give it a try, and if you run into problems, let us know.
    [ July 29, 2005: Message edited by: Merrill Higginson ]
     
    Don't get me started about those stupid light bulbs.
      Bookmark Topic Watch Topic
    • New Topic