Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

opening and closing of a dialog window in JSP

Posted on 2002-07-14
7
Medium Priority
?
629 Views
Last Modified: 2008-01-09
Hello everyone, i hope you can help  on this

I have a display.jsp file that opens a dialog window when a button is clicked. An input is then made in the dialog window (input.jsp). The dialog window's form is then submitted to another jsp page(without html) to process the inputted data then go back to display.jsp using pageContext.forward( "display.jsp" ).

When I opened the dialog window using 'window.open("input.jsp",...)' then close it using 'self.close'I got an IO exception error and no update was made in display.jsp.

When I used window.showModalDialog("input.jsp",....)then close it using self.close, display.jsp is updated but displayed in another window(browser).

How will I open the dialog window then update the display.jsp without opening a new browser window?
Is it possible to forward 'display.jsp' to previous browser where 'display.jsp' was first displayed? how will I do it?

thanks in advance
eaglesview
0
Comment
Question by:eaglesview
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:boolee
ID: 7156132
U can solve ur problem with javascript. I have done similar programs but I havent used forward() function to refresh the parent. What I did was I processed the data in the dialog window ( using window.open) , then in the next page of dialog window I wrote javascript functions to update the parent /opener window. then closed the dialog
0
 

Author Comment

by:eaglesview
ID: 7156189
what my dialog window does is that it displays select buttons for the user to select a field to be deleted in the database. That's why I have to submit the form to a jsp file that uses a class file and access the database. then go back to the opener window using pageContext.forward('display.jsp').
0
 
LVL 1

Expert Comment

by:boolee
ID: 7156549
OK. You delete the data using ur JSP. After that what do u want? I think u just need to refresh the parent window  to display new values from database. Here u can use javascript to refresh the parent and close the dialog.  that will be the easiest way
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:eaglesview
ID: 7158485
thanks..
yes.. I think you got my point. can you help me on my javascript code?
I have this code on my dialog window but it didn't worked right.

function submitForm(){
    self.yoteiform.submit();
    window.opener.write('display.jsp');
    window.close()
}
0
 
LVL 1

Accepted Solution

by:
boolee earned 450 total points
ID: 7158665
U first submit the dialog window, wait for the result. In the resultant page u can show a success message or leave it blank. In this page write a javascript function for refreshing parent and to close the window in the <body onLoad .. The script depends on the type of parent window. If there are frames u must locate the frame to be refreshed in the proper hierarchy. i,e like parent.opener.etc. For simple cases you can use
window.opener.location.reload(true)

 for refreshing parent but u must test this in netscape also. If there are only a few parameters are required to refresh ur parent window then make a url and assign it as location of parent.

it will be like

function refresh_parent()
{
 window.opener.location = "display.jsp?name1=value1&name2=value2...";//refresh parent
 window.close(); ///close dialog
}
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 7158823
> window.opener.location = "display.jsp?name1=value1&name2=value2...";//refresh parent

or window.opener.form1.action = "display.jsp?name1=value1&name2=value2...";//refresh parent
window.opener.form1.submit();

Is that means we must can the parent window's location/ or action (then submit it) property?

Just thinking if there is a better solution?

<learning..>
0
 

Author Comment

by:eaglesview
ID: 7158954
thanks.. it helped me a lot.
I did just what you've told me.
my problem was not really to refresh the page. the problem really was where to close the dialog window and display again the display.jsp without using pagecontext.forward(..)

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question