You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <as...@gmail.com> on 2007/04/02 18:37:27 UTC
How can i open new window and forward request to another action class
Hi
I have to handle the following situation.
1. When user click submit on the webpage, the request goes to the action
class.
2 This action class performs some task,
3 If the task is ok then this action class should forward the request to
another action class and also open a new browser window
4 if the task fails then this action class should forward the request to
another action class which displays user the error messages
How can i do step 3,
This is how i have defined it in struts-config.xml file
<action name="POApprovalForm"
type="com.pfizer.maps.action.purchase.POApprovalAction"
validate="false" input="/pages/ApprovalDataDisplay.jsp"
scope="request" path="/pages/purchase/POApprovalAction">
<forward name="success"
path="/pages/approvals/ApprovalDataDispatchAction.do?nextpage=home" />
<forward name="error"
path="/pages/purchasing/po.jsp" />
</action>
in my POApprovalAction i do the following
if (error.getCompletionFlag().equals("1"))
{
return mapping.findForward("error");
}
else
{
// this is where i want some thing to open a new browser window with
some parameters i would be sending
return mapping.findForward("success");
}
I cannot define _blank in my jsp page as i want the success to open in same
window,
Ashish
Re: [OT] How can i open new window and forward request to another
action class
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ashish,
Ashish Kulkarni wrote:
> 3 If the task is ok then this action class should forward the request to
> another action class and also open a new browser window
>
> How can i do step 3,
The only (semi) reliable way to do this is with javascript.
Are you saying that you want to submit a form, refresh the page /and/
popup a new window containing a third page?
Your form handler should return a page with a <body> element like this:
<body onload="var wnd=window.open('target-url'); wnd.focus();">
This will load your popup. This kind of user experience doesn't sound
very good IMO. :(
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGEVj99CaO5/Lv0PARArNTAJ9+vrlKJyMz+a1/LqXV18HXPp1bVgCfQcKt
7iGSHRDLS1U/WJ2KfVyIsGw=
=wymr
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org