You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Celinio Fernandes <ce...@yahoo.com> on 2010/03/23 14:02:49 UTC

[Struts 2.1.8] s:url : how to open in a new window ?

Hi,
I am using Struts 2.1.8.
In a JSP, I have a link which calls an action. I want to open that link in a new window. The following code works :
 <s:url id="genererRapportPDF" action="affichePDF" windowState="" /> 
  <s:a href="%{genererRapportPDF}" onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a>   
  
  
The problem is that it also calls the action / opens the link in the current window.
How to avoid that ?
Thanks.  
 


      

Re: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Celinio Fernandes <ce...@yahoo.com>.
Thanks, that works :)

--- On Tue, 3/23/10, Florin Cazacu <fl...@cst.ro> wrote:


From: Florin Cazacu <fl...@cst.ro>
Subject: Re: [Struts 2.1.8] s:url : how to open in a new window ?
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Tuesday, March 23, 2010, 9:36 AM


Hello,

You can avoid opening of the link in the current window removing the href attribute from <s:a> tag.

Florin Cazacu.

Celinio Fernandes wrote:
> Hi,
> I am using Struts 2.1.8.
> In a JSP, I have a link which calls an action. I want to open that link in a new window. The following code works :
>  <s:url id="genererRapportPDF" action="affichePDF" windowState="" />   <s:a href="%{genererRapportPDF}" onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a>       The problem is that it also calls the action / opens the link in the current window.
> How to avoid that ?
> Thanks.   
> 
>         


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




      

Re: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Florin Cazacu <fl...@cst.ro>.
Hello,

You can avoid opening of the link in the current window removing the 
href attribute from <s:a> tag.

Florin Cazacu.

Celinio Fernandes wrote:
> Hi,
> I am using Struts 2.1.8.
> In a JSP, I have a link which calls an action. I want to open that link in a new window. The following code works :
>  <s:url id="genererRapportPDF" action="affichePDF" windowState="" /> 
>   <s:a href="%{genererRapportPDF}" onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a>   
>   
>   
> The problem is that it also calls the action / opens the link in the current window.
> How to avoid that ?
> Thanks.  
>  
>
>
>       
>   


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


Re: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Brian Thompson <el...@gmail.com>.
What if I'm using the app, and I want to open the link in a new tab
instead?  Or how about, I want to open it in the same tab and just use
the back button once I'm done looking at the PDF?

-Brian



On Tue, Mar 23, 2010 at 8:02 AM, Celinio Fernandes <ce...@yahoo.com> wrote:
> Hi,
> I am using Struts 2.1.8.
> In a JSP, I have a link which calls an action. I want to open that link in a new window. The following code works :
>  <s:url id="genererRapportPDF" action="affichePDF" windowState="" />
>   <s:a href="%{genererRapportPDF}" onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a>
>
>
> The problem is that it also calls the action / opens the link in the current window.
> How to avoid that ?
> Thanks.
>
>
>
>

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


Re: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Brian Thompson <el...@gmail.com>.
Target blank isn't necessarily available (e.g. writing the site in xhtml 1.1)

-Brian



On Tue, Mar 23, 2010 at 10:06 AM, Robert Graf-Waczenski <rg...@lsoft.com> wrote:
> Hi!
>
> How about using
>
> target="_blank"
>
> instead of onclick?
>
> Robert
>
> Gustavo Felisberto schrieb:
>>
>> Hello,
>>
>> This is a JS thing. Try:
>> onclick="javascript:window.open('%{genererRapportPDF}'); return false;"
>>
>> Gustavo
>>
>> -----Mensagem original-----
>> De: Celinio Fernandes [mailto:cel975@yahoo.com] Enviada: terça-feira, 23
>> de Março de 2010 13:03
>> Para: Struts Users Mailing List
>> Assunto: [Struts 2.1.8] s:url : how to open in a new window ?
>>
>> Hi,
>> I am using Struts 2.1.8.
>> In a JSP, I have a link which calls an action. I want to open that link in
>> a
>> new window. The following code works :
>>  <s:url id="genererRapportPDF" action="affichePDF" windowState="" />
>> <s:a href="%{genererRapportPDF}"
>> onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a>
>>      The problem is that it also calls the action / opens the link in the
>> current
>> window.
>> How to avoid that ?
>> Thanks.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Robert Graf-Waczenski <rg...@lsoft.com>.
Hi!

How about using

target="_blank"

instead of onclick?

Robert

Gustavo Felisberto schrieb:
> Hello,
>
> This is a JS thing. Try:
> onclick="javascript:window.open('%{genererRapportPDF}'); return false;"
>
> Gustavo
>
> -----Mensagem original-----
> De: Celinio Fernandes [mailto:cel975@yahoo.com] 
> Enviada: terça-feira, 23 de Março de 2010 13:03
> Para: Struts Users Mailing List
> Assunto: [Struts 2.1.8] s:url : how to open in a new window ?
>
> Hi,
> I am using Struts 2.1.8.
> In a JSP, I have a link which calls an action. I want to open that link in a
> new window. The following code works :
>  <s:url id="genererRapportPDF" action="affichePDF" windowState="" /> 
>   <s:a href="%{genererRapportPDF}"
> onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a> 
>  
>   
>   
> The problem is that it also calls the action / opens the link in the current
> window.
> How to avoid that ?
> Thanks.  
>  
>
>
>       
>
>
> ---------------------------------------------------------------------
> 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: [Struts 2.1.8] s:url : how to open in a new window ?

Posted by Gustavo Felisberto <gu...@wit-software.com>.
Hello,

This is a JS thing. Try:
onclick="javascript:window.open('%{genererRapportPDF}'); return false;"

Gustavo

-----Mensagem original-----
De: Celinio Fernandes [mailto:cel975@yahoo.com] 
Enviada: terça-feira, 23 de Março de 2010 13:03
Para: Struts Users Mailing List
Assunto: [Struts 2.1.8] s:url : how to open in a new window ?

Hi,
I am using Struts 2.1.8.
In a JSP, I have a link which calls an action. I want to open that link in a
new window. The following code works :
 <s:url id="genererRapportPDF" action="affichePDF" windowState="" /> 
  <s:a href="%{genererRapportPDF}"
onclick="javascript:window.open('%{genererRapportPDF}');">Generation</s:a> 
 
  
  
The problem is that it also calls the action / opens the link in the current
window.
How to avoid that ?
Thanks.  
 


      


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