Struts - Forward to "Dialog"

J

John Pailing

I currently have a form which has several buttons. When the user
click on one of the buttons the Action for the Form uses some business
logic to decide which page the user should see next. All pretty
standard so far!

However we would like the new page that appears to appear as a dialog
box rather than a new page within the browser. In other words as if
the javascript "window.open" had been used to load the page. Is there
a simple way I can do this in Struts?

I have tried putting the following in the Action Mapping Forward Path
"javascript:window.open('/ourapp/newpage.jsp')", however I get an 500
internal error. And I'm not sure how it would know how to fill out
the URL if it did work i.e. How it would change "/ourapp/newpage.jsp"
to http://ourserver:7001/ourapp/newpage.jsp?

Other ideas is to have a central .jsp page which you would pass the
name of the dialog .jsp you want to open, and let it do the work for
you. But I can see this being very messy.

The only other idea I have is to try and overide the struts request
processer, but I'm new to struts and don't know if this is achievable.

As I'm new to Struts, I'm sure I am missing something!

Any help appreciated, Many Thanks

John Pailing
 
J

Jeff

I currently have a form which has several buttons. When the user
click on one of the buttons the Action for the Form uses some business
logic to decide which page the user should see next. All pretty
standard so far!

However we would like the new page that appears to appear as a dialog
box rather than a new page within the browser. In other words as if
the javascript "window.open" had been used to load the page. Is there
a simple way I can do this in Struts?

I have tried putting the following in the Action Mapping Forward Path
"javascript:window.open('/ourapp/newpage.jsp')", however I get an 500
internal error. And I'm not sure how it would know how to fill out
the URL if it did work i.e. How it would change "/ourapp/newpage.jsp"
to http://ourserver:7001/ourapp/newpage.jsp?

Other ideas is to have a central .jsp page which you would pass the
name of the dialog .jsp you want to open, and let it do the work for
you. But I can see this being very messy.

The only other idea I have is to try and overide the struts request
processer, but I'm new to struts and don't know if this is achievable.

As I'm new to Struts, I'm sure I am missing something!

Any help appreciated, Many Thanks

John Pailing


In the <html:form> tag, set the 'target' attribute to something, i.e.

<html:form action='someAction' target='new_window' >


assuming that you want to open in a new window every time...
 
J

John Pailing

In the <html:form> tag, set the 'target' attribute to something, i.e.

<html:form action='someAction' target='new_window' >


assuming that you want to open in a new window every time...

Thanks for the help, but there doesn't seem to be an option to select
the new window to appear as a dialog though, only as a new page? I'm
after the effects you get with window.open or window.showModalDialog
in Javascript
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top