Anthony,
Here's another option. If, in your Action, it's determined that the popup
is needed, set a request attribute. Then in your JSP, check for the
existence of the request attribute, using <logic:present> for example, and
create a custom tag to generate the required Javascript. The custom tag
could even get needed data from the request. For example,
<logic:present name="popup">
<mytag:popup />
</logic:present>
The popupTag class would then generate and write the appropriate Javascript.
HTH,
Karen
-----Original Message-----
From: Sobkowski, Andrej [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 12, 2001 6:20 AM
To: 'Struts Users Mailing List'
Subject: RE: Generate Javascript popup from Action
Anthony,
the Action itself has no idea of the front end (the HTML/Javascript pages).
It would work just as well if the presentation layer was a Java Swing GUI or
whatever. So I'd say that no, you can't open a JS window from your Action.
What you can do is playing with the Action execution and the returned pages
with the <body onload=""> Javascript:
- call the Action to perform any processing or validation
- if you don't need the popup, that's standard stuff
- if you need to open a popup after the execution, generate a page that uses
<body onload="openPopup(URL);"> or similar
I realize this is not optimal (it's a "hacky" approach) but I'm pretty sure
it can be modeled properly. And there may be better ways to handle it (that
I'm unaware of :) )
HTH
Andrej
> -----Original Message-----
> From: Anthony Chater [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 12, 2001 6:20 AM
> To: 'Struts Users Mailing List'
> Subject: Generate Javascript popup from Action
>
>
> I have a page which calls an Action in the standard way.
> However in some
> situations, ie as a result of logic executed in my Action
> class, I need to
> generate a popup window on top of the page before proceeding. Is it
> possible to do this from within my action?
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>