Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting parameters from a pop-up window

 
sailaja parepalli
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Does anybody know how to work with pop-up windows in a jsp?

I could display a pop-up window by sending a value from the parent jsp as the request parameter. The jsp in the pop-up window takes this parameter and displays a set of values on the window depending on the parameter value. The user should select a value from these set of values.

Now I need to send the selected value back to the parent window as soon as I select a value in the pop up window. This pop up window also should get closed immediately.

I appreciate if anybody can tell me how to achieve this.

Thanks.
[ April 13, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is all client-side activity. Moving to the HTML/Javascript forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I need to send the selected value back to the parent window as soon as I select a value in the pop up window.


Your Javascript handler can reference the main page via the opener variable, which you can use to trigger any changes in the parent page.
 
rahul V kumar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
sailaja parepalli
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much for the reply.
 
sailaja parepalli
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply too Rahul.

I could send a value back from the pop-up window.

Do you know how to send the user authentication information to the new window without embedding the password in the url?

Thanks again.
 
Dharmanand Singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sailaja parepalli:
Hi all,
Does anybody know how to work with pop-up windows in a jsp?
...
Thanks.


On the pop up page, include a javascript function which will be called on submitting the pop up box. Now you can populate the fields of the parent window or populate the value of any hidden field on the parent window by the javascript statement:
window.opener.document.<object_name (or form_name)>.value = <value_on_pop_up_page>;

Basically, window.opener.document will give you the document object of the parent page, and then you can play on further.
[ November 18, 2004: Message edited by: Dharmanand Singh ]
 
suresh india
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Bear edit: personal message removed. Please do not use the forums for personal messages.]
[ January 25, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"suresh india"

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Since you have revealed that your real name is Suresh Parepall, that is the display name that you must use.

Thanks!
bear
JavaRanch Sheriff
[ January 25, 2007: Message edited by: Bear Bibeault ]
 
Suhas Lonarkar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have face the Same problem with pop up's
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic