This should probably be an answer on the Wiki since I see this asked quite a 
bit...

No, you cannot open a new window from an Action.  Not directly anyway.  Opening 
a window is strictly a client-side activity.  Therefore, you have two choices:

(1) Submit a form to _blank, as you said (actually, I think it's _new, but my 
memory sucks so I'm not sure)

(2) Use Javascript to open it, as you have already

I have something similar on all my pages... I can return a message from any 
Action that is displayed via JS alert().  To do this, I simply send a "message" 
attribute back in request, and every page checks if it's null onLoad, and if 
not calls:

alert("<%=(String)request.getAttribute("message")%>");

Since all my JSP's import a common file for things like this, it's only in one 
place.

I'm not sure if you want the new window to open in response to a for submission 
(in which case just targeting a new window is probably the better idea) or 
variably depending on what the server returns.  I think it's the later based on 
what you said, so I think something like I do would suit you.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, January 19, 2005 12:47 pm, Ashish Kulkarni said:
> Hi
> can we open a new window from action class?
> i dont want to use
> <form action="display.jsp" method="post"
> target="_blank">
> as i want to be able to open this new window from any
> form( i have a menu option which can be executed from
> any page of my website)
> Basically i have a java script which looks like this
> TheNewWin = window.open(url, '',
> config='height='+height+', width='+width+',
> toolbar=no, menubar=no,scrollbars=no,resizable=no,
> location=no,directories=no, status=no
> ,offscreenBuffering=false');
> 
> Ashish
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to