You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Al Sutton <al...@alsutton.com> on 2008/01/03 09:34:42 UTC

[S2] Opening a new window upon a link click without Javascript

Heres channelge for the day...
 
I have a page which contains a link, when the user clicks the link they get
a PDF which they need to go off and do something with (not part of the
webapp).
 
What I'd like to do is open a new browser window with the PDF in and retain
the page with link in the original window without using JavaScript.
 
In HTML I can do this using target="_blank" in the <a> tag, but with the
<s:a> tag there is no ability to specify the target attribute.
 
As a further mind bend there is a targets attribute for <s:a> in the tld for
2.0.11, but it doesn't get mentioned in the documentation and appears not to
be processed by the tag processing code (so maybe the tld needs a tidy).
 
Anyone got any thoughts?
 
Al.
 
P.S. This isn't a biggie for me as I'm going to use;
 
<a href="<s:property value='%{downloadLink}'/>" target="_blank"><s:property
value="step.name"/></a>

instead of a s:a solution for the moment, it just feels like s:a is missing
some functionality if I have to revert back to switch between s:a and HTMLs
a tag.



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


Re: [S2] Opening a new window upon a link click without Javascript

Posted by Gabriel Belingueres <be...@gmail.com>.
AFAIK, the <s:a> tag is best used when designing ajax applications,
meaning the usual interaction is to update the same browser window.

I would stay with the common HTML anchor tag to open a new window.

Gabriel


2008/1/3, Al Sutton <al...@alsutton.com>:
> Heres channelge for the day...
>
> I have a page which contains a link, when the user clicks the link they get
> a PDF which they need to go off and do something with (not part of the
> webapp).
>
> What I'd like to do is open a new browser window with the PDF in and retain
> the page with link in the original window without using JavaScript.
>
> In HTML I can do this using target="_blank" in the <a> tag, but with the
> <s:a> tag there is no ability to specify the target attribute.
>
> As a further mind bend there is a targets attribute for <s:a> in the tld for
> 2.0.11, but it doesn't get mentioned in the documentation and appears not to
> be processed by the tag processing code (so maybe the tld needs a tidy).
>
> Anyone got any thoughts?
>
> Al.
>
> P.S. This isn't a biggie for me as I'm going to use;
>
> <a href="<s:property value='%{downloadLink}'/>" target="_blank"><s:property
> value="step.name"/></a>
>
> instead of a s:a solution for the moment, it just feels like s:a is missing
> some functionality if I have to revert back to switch between s:a and HTMLs
> a tag.
>
>
>
> ---------------------------------------------------------------------
> 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