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 <ku...@yahoo.com> on 2005/01/19 20:27:42 UTC
Re: open new window form struts action..java script variable
Hi
thanx guys for the clarification, here is a very
intresting problem with defining target and opening
new window,
suppose you open a new window using java script in
mypage.jsp
your code will be like below in mypage.jsp
var TheNewWin;
if(!TheNewWin || TheNewWin.closed)
{
TheNewWin = window.open('abc.jsp');
}
else
{
TheNewWin.focus();
}
for some reason you browse to mypage2.jsp and then
come back to mypage.jsp
and call this java script, it will open a new window
(remmemer we have not closed the previous window)
because variable TheNewWin is defined again, and as no
knowledge of the already open window,
how will you handle this situation
Ashish
--- fzlists@omnytex.com wrote:
> Geez, I wish I'd have known that before! So are you
> saying that if the browser doesn't recognize the
> target as one of the predefined types, it will
> assume it should open a new window named according
> to the target value? That's cool, and I didn't know
> it. It would have saved me some trouble a few weeks
> back because I had to add some code to a system to
> deal with a situation where a popup window might
> have been opened and things broke if a certain
> request was submitted again with it still open. I
> just added a quick Javascript check and closed the
> window if it was open before submitting the form,
> but this would have been much better!
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Wed, January 19, 2005 1:50 pm, PA said:
> >
> > On Jan 19, 2005, at 19:05, fzlists@omnytex.com
> wrote:
> >
> >> For my own edification, can you expand on the
> ability to "...define
> >> whatever target you like"? I've never heard that
> before, I'd be
> >> interested to know more. I'm wondering
> specifically since the browser
> >> wouldn't know what anything other than the
> defined targets you
> >> referenced meant, how would you go about handling
> them yourself? Can
> >> you give an example use case?
> >
> > The target can be named anyway you choose. This is
> handy when you want
> > to create an external window and consistently
> reuse it (e.g. always
> > open external link in "target = 'externalLink'").
> >
> > Cheers
> >
> > --
> > PA
> > http://alt.textdrive.com/
> >
> >
> >
>
---------------------------------------------------------------------
> > 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
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: open new window form struts action..java script variable
Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi
it is not the name, when you exit from that jsp page
and revisit it, the variable is defined again, and
does not refer to the previously defined, and so have
no clue of te open browser window
Ashish
--- "David G. Friedman" <hu...@ix.netcom.com> wrote:
> Why not set the window name to something specific
> such as mysite_com_popup
> and then use that name as a target in the future?
>
> Regards,
> David
>
> -----Original Message-----
> From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Wednesday, January 19, 2005 2:28 PM
> To: Struts Users Mailing List
> Subject: Re: open new window form struts
> action..java script variable
>
>
> Hi
> thanx guys for the clarification, here is a very
> intresting problem with defining target and opening
> new window,
> suppose you open a new window using java script in
> mypage.jsp
> your code will be like below in mypage.jsp
> var TheNewWin;
> if(!TheNewWin || TheNewWin.closed)
> {
> TheNewWin = window.open('abc.jsp');
> }
> else
> {
> TheNewWin.focus();
> }
> for some reason you browse to mypage2.jsp and then
> come back to mypage.jsp
> and call this java script, it will open a new window
> (remmemer we have not closed the previous window)
> because variable TheNewWin is defined again, and as
> no
> knowledge of the already open window,
> how will you handle this situation
> Ashish
> --- fzlists@omnytex.com wrote:
>
> > Geez, I wish I'd have known that before! So are
> you
> > saying that if the browser doesn't recognize the
> > target as one of the predefined types, it will
> > assume it should open a new window named according
> > to the target value? That's cool, and I didn't
> know
> > it. It would have saved me some trouble a few
> weeks
> > back because I had to add some code to a system to
> > deal with a situation where a popup window might
> > have been opened and things broke if a certain
> > request was submitted again with it still open. I
> > just added a quick Javascript check and closed the
> > window if it was open before submitting the form,
> > but this would have been much better!
> >
> > --
> > Frank W. Zammetti
> > Founder and Chief Software Architect
> > Omnytex Technologies
> > http://www.omnytex.com
> >
> > On Wed, January 19, 2005 1:50 pm, PA said:
> > >
> > > On Jan 19, 2005, at 19:05, fzlists@omnytex.com
> > wrote:
> > >
> > >> For my own edification, can you expand on the
> > ability to "...define
> > >> whatever target you like"? I've never heard
> that
> > before, I'd be
> > >> interested to know more. I'm wondering
> > specifically since the browser
> > >> wouldn't know what anything other than the
> > defined targets you
> > >> referenced meant, how would you go about
> handling
> > them yourself? Can
> > >> you give an example use case?
> > >
> > > The target can be named anyway you choose. This
> is
> > handy when you want
> > > to create an external window and consistently
> > reuse it (e.g. always
> > > open external link in "target =
> 'externalLink'").
> > >
> > > Cheers
> > >
> > > --
> > > PA
> > > http://alt.textdrive.com/
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > 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
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> http://promotions.yahoo.com/new_mail
>
>
---------------------------------------------------------------------
> 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
>
>
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: open new window form struts action..java script variable
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Why not set the window name to something specific such as mysite_com_popup
and then use that name as a target in the future?
Regards,
David
-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Wednesday, January 19, 2005 2:28 PM
To: Struts Users Mailing List
Subject: Re: open new window form struts action..java script variable
Hi
thanx guys for the clarification, here is a very
intresting problem with defining target and opening
new window,
suppose you open a new window using java script in
mypage.jsp
your code will be like below in mypage.jsp
var TheNewWin;
if(!TheNewWin || TheNewWin.closed)
{
TheNewWin = window.open('abc.jsp');
}
else
{
TheNewWin.focus();
}
for some reason you browse to mypage2.jsp and then
come back to mypage.jsp
and call this java script, it will open a new window
(remmemer we have not closed the previous window)
because variable TheNewWin is defined again, and as no
knowledge of the already open window,
how will you handle this situation
Ashish
--- fzlists@omnytex.com wrote:
> Geez, I wish I'd have known that before! So are you
> saying that if the browser doesn't recognize the
> target as one of the predefined types, it will
> assume it should open a new window named according
> to the target value? That's cool, and I didn't know
> it. It would have saved me some trouble a few weeks
> back because I had to add some code to a system to
> deal with a situation where a popup window might
> have been opened and things broke if a certain
> request was submitted again with it still open. I
> just added a quick Javascript check and closed the
> window if it was open before submitting the form,
> but this would have been much better!
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Wed, January 19, 2005 1:50 pm, PA said:
> >
> > On Jan 19, 2005, at 19:05, fzlists@omnytex.com
> wrote:
> >
> >> For my own edification, can you expand on the
> ability to "...define
> >> whatever target you like"? I've never heard that
> before, I'd be
> >> interested to know more. I'm wondering
> specifically since the browser
> >> wouldn't know what anything other than the
> defined targets you
> >> referenced meant, how would you go about handling
> them yourself? Can
> >> you give an example use case?
> >
> > The target can be named anyway you choose. This is
> handy when you want
> > to create an external window and consistently
> reuse it (e.g. always
> > open external link in "target = 'externalLink'").
> >
> > Cheers
> >
> > --
> > PA
> > http://alt.textdrive.com/
> >
> >
> >
>
---------------------------------------------------------------------
> > 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
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
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