• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Popup window not working

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gurus please help me. I am not able to get my popup window working correctly.

In my jsp when user clicks "Submit" button the request goes to a Servlet and I would like to display the response from the Servlet into a popup window (Which basically contains only higher level info) When user clicks the "View Detail" button to view the detail information on pop up window the request goes back to Servlet again and I would like the response from the Servlet back to Original that is my parent window.

Now my problem is as soon as I click "Submit" button on my first JSP page I loose the content of my page. To avoid that is used target='_blank" to create new window. But new window looks just like standard window but I need a popup window. And more then that when I click "View Detail" button on new window all the response from the Servlet gets displayed in new window rather then parent window.

Please let me know how I can make this thing work

Thanks,
Maria
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you need to control the popup window you'll need to use the javascript function window.open rather that target='_blank' on the form. When you pass in the URL to window.open you'll need to supply all the required params as querystrings on the URL.

As to your second problem, again, you'll need to use Javascript to refresh the parent window with the new data.
 
Sheriff
Posts: 67746
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
Moved to the HTML forum.
 
Maria Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not much familiar with the JavaScript Can you Please give me an example.
And one more thing I do use Servlet response object to open a pop up window where I don�t have an URL to click is it possible to do this using java script?

Thanks for your help
 
Maria Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg can you please help with solution or give me an example how to open a pop up window when i get response from servlet

thanks
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.quirksmode.org/js/popup.html

HTH.
 
Maria Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your response

But I need to create a popup window based on response object from a Servlet and same thing goes true with redirecting content to parent window.
I cann't use a link or click some link to create a popup.

Can someone please let me know is it possible to create a popup and redirect back to parent window using response from server side
 
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may not be the best way to do it but I would send the data from the parent window to the child window using javascript then call the servlet from the child window.
 
Maria Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But that is going to look ugly because I am opening a popup window as I click submit button and after 30 seconds showing some data from database
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maria,

I hope your javascript exists in a jsp or a servlet. If so, you can dynamically create the javascript that opens up the window itself, and embed the data in the querystring.

You can have a common javascript function such as:


Now all you have to do is to create the anchor tags dynamically. E.g.:



Your smallWindow.jsp would look like:


Please be aware of the following:
  • Please know that the HTML query string has certain limitations regarding the amount of data that can be sent through. (query string has a maximum length).
  • Users can read the data sent through the query string which makes it unsuitable for sensitive data transfer.
  • Certian special characters such as the + sign and & maybe lost or replaced since these are control characters.


  • good luck

    [ August 03, 2006: Message edited by: Isuru Sampath ]
    [ August 03, 2006: Message edited by: Bear Bibeault ]
     
    Bear Bibeault
    Sheriff
    Posts: 67746
    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

    Originally posted by Isuru Sampath:
    Now all you have to do is to create the anchor tags dynamically.



    If you are using JSP, the example shown is not a good way to create a URL. You will run into problems if any of the values require encoding, and it's easy to introduce formatting errors.

    Rather, to generate URLs in a JSP, explore the use of the <c:url> JSTL action.
     
    Isuru Sampath
    Ranch Hand
    Posts: 57
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Bear Bibeault:


    If you are using JSP, the example shown is not a good way to create a URL. You will run into problems if any of the values require encoding, and it's easy to introduce formatting errors.

    Rather, to generate URLs in a JSP, explore the use of the <c:url> JSTL action.



    Excellent Bear, Thanks for pointing this out. That way we can avoide the control character problems.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic