You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Angharad Stapleton <a_...@chiconi.com> on 2004/07/23 15:05:57 UTC

Popups with Struts.

Hi

I have a form which I am using javascript to get information from the form
and open up a new popup window with information. This is causing limitations
on the information I am passing through.

I want to pass the information through a Struts action and have Struts then
pass the information back and populate the popup window. I can't figure out
how to do this. The only way I can think of at the moment is to store
information in session, and pass control back to form page with a parameter
that would tell it to open a pop-up window and get the information from the
session. I'm thinking there is probably an easier way to do this.

Thanks
Angharad


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Popups with Struts.

Posted by Angharad Stapleton <a_...@chiconi.com>.
Thanks for your replies. Figured out an really easy way to do this. In my
struts config for the forwarding path I use
"javascript:popUp('windowx.jsp')" and this then opens 'windowx.jsp' in a new
popUp window.

PopUp in a javascript function we have to open a new window so I suppose
window.open() would work just as well.

-----Original Message-----
From: Richard Mixon (qwest) [mailto:rnmixon@qwest.net]
Sent: 23 July 2004 16:50
To: Struts Users Mailing List
Subject: RE: Popups with Struts.


> Another way would be to pass the needed information as
> request parameters
> when you pop the window.  It's a separate request (which is
> probably what's
> causing your initial data-passing problem) so you can send it
> ?parameters=on&the=url.

Do not want to be too paranoid, but you should be sure the data you are
passing as request parameters is not sensitive, nor does it provide an
opportunity for someone to hack into your application. In a sense you
end up publishing/exposing a public interface to your application this
way - which is fine if that's what you want to tod.

You can hide the address and parameters by setting the window properties
something like the following

window.open(destURL,winName,',toolbar=1,location=0,directories=1,status=
1,menuBar=1,scrollBars=1,resizable=1');
where I've set "location=0", there are browser plug-ins that will still
let someone inspect and change the request.

I have struggled with the same problem, none of the solutions are too
elegant:
1) From the first window use "window.open" to open the second window,
issuing a request with all of those request parameters.
2) Submit a request from the first window that saves the data of
interest in the HTTP session. Upon receiving the response, use
Javascript to open the second window, this time with a request URL (very
simple URL, either few or no request parms) to a simple Struts action,
that picks up the data from the HTTP session and displays it in the
second window.
3) Use Javascript to open a second window, then use Javascript to "copy"
data from the first window to the second (not sure if this solves
Angharad's specific problem).

I have recently moved a number of charting pages from the approach #1 to
approach #2. At first I was not thrilled because I ended up increasing
the total number of requests from one to two, but after working through
it I was quite happy. Approach #2 made it easier to build a more
wizard-like, prompted solution - more "user friendly".

Hope this helps.

> -----Original Message-----
> From: Wendy Smoak [mailto:java@wendysmoak.com]
> Sent: Friday, July 23, 2004 8:05 AM
> To: Struts Users Mailing List
> Subject: Re: Popups with Struts.
>
>
> From: "Angharad Stapleton" <a_...@chiconi.com>
> > The only way I can think of at the moment is to store
> > information in session, and pass control back to form page with a
> parameter
> > that would tell it to open a pop-up window and get the
> information from
> the
> > session. I'm thinking there is probably an easier way to do this.
>
> Session is probably the easiest way to do it.  If your
> session is getting
> cluttered with a bunch of  Attributes, then consider creating
> a class to
> encapsulate the ones that go together, or at least put them in a Map.
>
> Another way would be to pass the needed information as
> request parameters
> when you pop the window.  It's a separate request (which is
> probably what's
> causing your initial data-passing problem) so you can send it
> ?parameters=on&the=url.
>
> HTH,
> Wendy Smoak
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Popups with Struts.

Posted by "Richard Mixon (qwest)" <rn...@qwest.net>.
> Another way would be to pass the needed information as
> request parameters
> when you pop the window.  It's a separate request (which is
> probably what's
> causing your initial data-passing problem) so you can send it
> ?parameters=on&the=url.

Do not want to be too paranoid, but you should be sure the data you are
passing as request parameters is not sensitive, nor does it provide an
opportunity for someone to hack into your application. In a sense you
end up publishing/exposing a public interface to your application this
way - which is fine if that's what you want to tod.

You can hide the address and parameters by setting the window properties
something like the following

window.open(destURL,winName,',toolbar=1,location=0,directories=1,status=
1,menuBar=1,scrollBars=1,resizable=1');
where I've set "location=0", there are browser plug-ins that will still
let someone inspect and change the request.

I have struggled with the same problem, none of the solutions are too
elegant:
1) From the first window use "window.open" to open the second window,
issuing a request with all of those request parameters.
2) Submit a request from the first window that saves the data of
interest in the HTTP session. Upon receiving the response, use
Javascript to open the second window, this time with a request URL (very
simple URL, either few or no request parms) to a simple Struts action,
that picks up the data from the HTTP session and displays it in the
second window.
3) Use Javascript to open a second window, then use Javascript to "copy"
data from the first window to the second (not sure if this solves
Angharad's specific problem).

I have recently moved a number of charting pages from the approach #1 to
approach #2. At first I was not thrilled because I ended up increasing
the total number of requests from one to two, but after working through
it I was quite happy. Approach #2 made it easier to build a more
wizard-like, prompted solution - more "user friendly".

Hope this helps.

> -----Original Message-----
> From: Wendy Smoak [mailto:java@wendysmoak.com]
> Sent: Friday, July 23, 2004 8:05 AM
> To: Struts Users Mailing List
> Subject: Re: Popups with Struts.
>
>
> From: "Angharad Stapleton" <a_...@chiconi.com>
> > The only way I can think of at the moment is to store
> > information in session, and pass control back to form page with a
> parameter
> > that would tell it to open a pop-up window and get the
> information from
> the
> > session. I'm thinking there is probably an easier way to do this.
>
> Session is probably the easiest way to do it.  If your
> session is getting
> cluttered with a bunch of  Attributes, then consider creating
> a class to
> encapsulate the ones that go together, or at least put them in a Map.
>
> Another way would be to pass the needed information as
> request parameters
> when you pop the window.  It's a separate request (which is
> probably what's
> causing your initial data-passing problem) so you can send it
> ?parameters=on&the=url.
>
> HTH,
> Wendy Smoak
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Popups with Struts.

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Angharad Stapleton" <a_...@chiconi.com>
> The only way I can think of at the moment is to store
> information in session, and pass control back to form page with a
parameter
> that would tell it to open a pop-up window and get the information from
the
> session. I'm thinking there is probably an easier way to do this.

Session is probably the easiest way to do it.  If your session is getting
cluttered with a bunch of  Attributes, then consider creating a class to
encapsulate the ones that go together, or at least put them in a Map.

Another way would be to pass the needed information as request parameters
when you pop the window.  It's a separate request (which is probably what's
causing your initial data-passing problem) so you can send it
?parameters=on&the=url.

HTH,
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org