You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Craig Christophersen <cr...@synesis7.com> on 2004/07/15 01:21:59 UTC

Opening a sendRedirect in a new window

>From my Velocity Controller Servlet I am trying to open a redirect in a new window.  I have tried putting javascript window.open in the template that requests the new window but of course the request really goes thru the Controller servlet.  In my Controller I grab a few parameters to send with the request as follows:
 url = new String("/navCoc/baseFrameset.htm?docId=" + doc + "&userId=" + id + "&fName=" + fName );
try {
            res.sendRedirect(res.encodeRedirectURL(url));
          }

This all works fine in my Controller. But I need to open this request in a new window.  Any suggestions on how I might do this?

Craig Christophersen
(406)496-6421
craigch@synesis7.com

Re: Opening a sendRedirect in a new window

Posted by Mike Kienenberger <mk...@alaska.net>.
"Charles N. Harvey III" <ch...@alloy.com> wrote:
> To open a new window you need javascript:
> 
> That will open up ${url} in a new window.  Velocity is server-side
> and cannot do anything with the browser.


While it's true that this is a non-velocity issue, it's also true that you 
can do this with standard HTML.

<A HREF="newwindow.html" TARGET="_blank">a new window</A>

See the following link for more details.

http://www.faqs.org/docs/htmltut/linking/_A_TARGET_95y98y108y97y110y107y.html

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


Re: Opening a sendRedirect in a new window

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
To open a new window you need javascript:

<script type="text/javascript">
window.open( ${url}, PopUp, 
'resizable=yes,menubar=no,toolbar=no,location=no,status=yes,
                             
scrollbars=no,width=200,height=200,left=200,top=200' );
</script>

That will open up ${url} in a new window.  Velocity is server-side
and cannot do anything with the browser.


Charlie



Craig Christophersen said the following on 7/14/2004 7:21 PM:

>>>From my Velocity Controller Servlet I am trying to open a redirect in a new window.  I have tried putting javascript window.open in the template that requests the new window but of course the request really goes thru the Controller servlet.  In my Controller I grab a few parameters to send with the request as follows:
> url = new String("/navCoc/baseFrameset.htm?docId=" + doc + "&userId=" + id + "&fName=" + fName );
>try {
>            res.sendRedirect(res.encodeRedirectURL(url));
>          }
>
>This all works fine in my Controller. But I need to open this request in a new window.  Any suggestions on how I might do this?
>
>Craig Christophersen
>(406)496-6421
>craigch@synesis7.com
>  
>

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