File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Popup window not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Popup window not working" Watch "Popup window not working" New topic
Author

Popup window not working

Maria Smith
Ranch Hand

Joined: Apr 01, 2004
Posts: 40
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
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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.


GenRocket - A Test Data Generation Platform
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Moved to the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maria Smith
Ranch Hand

Joined: Apr 01, 2004
Posts: 40
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

Joined: Apr 01, 2004
Posts: 40
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
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

http://www.quirksmode.org/js/popup.html

HTH.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Maria Smith
Ranch Hand

Joined: Apr 01, 2004
Posts: 40
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
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
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.


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
Maria Smith
Ranch Hand

Joined: Apr 01, 2004
Posts: 40
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
Isuru Sampath
Ranch Hand

Joined: Jun 26, 2003
Posts: 56
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 ]

    No Winds No Waves
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60046
        
      65

    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

    Joined: Jun 26, 2003
    Posts: 56
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Popup window not working
     
    Similar Threads
    Problem in displaying value from session object
    page expired when clicking back button of browser.
    Popup Question
    Passing data from jsp to jsp to servlets to jsp (OR) NOT to process user's req again
    Update Value from a child window