This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes redirect without http:// or http: ecc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "redirect without http:// or http: ecc" Watch "redirect without http:// or http: ecc" New topic
Author

redirect without http:// or http: ecc

fabio fabios
Greenhorn

Joined: Jun 13, 2011
Posts: 4
Hi everyone,
this is my first post i have a question for you.
I would like to make a type deirect www.google.com
I tried this code but does not work.



the result is http://mysite/mycontext/www.google.com
if I use http://www.google.com the same code work.

How can I fix, I need to redirect a direct non-face-frame config.
thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Welcome to the JavaRanch, Fabio!

URLs come in 2 forms: Absolute and Relative.

An Absolute URL contains all the components of the actual URL. For example: http://www.google.com

A Relative URL omits components. However, since an Absolute URL is required to make an actual HTTP request, the client will supply the missing information in order to build an Absolute URL from the relative URL. Relative URLs are relative to the URL of the requesting page, so if you place a URL link in the form 'href="www.google.com"' on the page you served from "http://www.mywebserver.com/faces/page1.jsp", the client (browser) would build the absolute URL of "http://www.myserver.com/faces/www.google.com".

Which is why your request didn't work.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Consider Paul's rocket mass heater.
 
subject: redirect without http:// or http: ecc
 
Similar Threads
Problem with Navigation in subview
Navigation from JSF page to Non JSF page
how we forward a JSF page into Servlet
JSF redirect to another page
Call spring controller from faces-config.xml