wood burning stoves 2.0*
The moose likes JSF and the fly likes Redirecting to a Page outside the web project 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 "Redirecting to a Page outside the web project" Watch "Redirecting to a Page outside the web project" New topic

Redirecting to a Page outside the web project

Gaurav Kushwaha

Joined: May 20, 2009
Posts: 19
How do I redirect a JSF page to a page which is outside the web project (for eg. I have to redirect the a jsf page to a page
present in the workdir location)...... Is this possible ?
How about doing it through a JSP page ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950

It would be a serious security problem if you could do that arbitrarily. I don't even want to think about the exploits that would open up.

Then again, as I like to point out, a WEB server is NOT a FILE server. The only reason any files get copied from a web app directory is that a web logic module decided to do so. So if you want to create a servlet that gets its page source from some external directory and copies it back to the requester, that's fine. Just be careful.

Note that when I say "copies", I mean just that. It's trivial to design a servlet/JSP that copies HTML, JavaScript, CSS, image or similar files to the client's response stream from any place in the server's filesystem. However, if you need processing (for example, trying to do an external JSF page file), that's a little trickier, since the default JSF servlet is expecting to find resources in its classpath (that is, inside the WAR). You'd actually have to extend the JSF servlet to handle that.

Customer surveys are for companies who didn't pay proper attention to begin with.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Redirecting to a Page outside the web project
Similar Threads
how to access a session value on JSF page?
Redirect in a JSF page itself dependent on which panelGrid is rendered:
Confusing with JSF redirect
why my web pages are downloadable?
Handling session timeout and session invalidate differently