Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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: 16540

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
nimo frey
Ranch Hand

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

Have you tried LearnNowOnline?
subject: cannot access site from subdirectory