File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes cannot access site from subdirectory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "cannot access site from subdirectory" Watch "cannot access site from subdirectory" New topic

cannot access site from subdirectory

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580

I have put a site hello.xhtml into a subdirectory called "category" and put a link going to this site:

<hutputLink value="category/hello.xhtml" title="hello">

Now, I want to access the page via:

But it does not work. The browser cannot find this site (HTTP Status 404) although my WAR has this site into this directory.

When I put the site out of the subdirectory, then it works:
<hutputLink value="/hello.xhtml" title="hello">

But I want to have subdirectories. How can I do that?
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Give the full path and it will work. Don't give the relative path. Or if you want to give relative path use / at the start of the URL, It may work as I am not very sure. But complete or absolute URL will work for sure.

My Blog SCJP 5 SCWCD 5
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17280

Looks like another one of those cases where people think just because a URL has slashes in it that it's exactly the same thing as a file path.

It's not.

Check your web.xml and see how it decodes URLs with ".xhtml" in them.

An IDE is no substitute for an Intelligent Developer.
nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
cool, that helps!

I agree. Here's the link:
subject: cannot access site from subdirectory
jQuery in Action, 3rd edition