I have problem to link pages. I used <h:link> which is fine and working when all pages in the same directory. but when I try to link the pages that are located in sub directories. It is now working. here is some code, if anyone can help me.
this code is perfectly working
but the following code does not works
I am try to link a page from a directory called staff to main page in another directory called admin
Your first mistake was when you used the term "directory". URLs may look like filesystem paths, but they are not filesystem paths. They are resource locator strings. The slashes are simply parts of the URL strings and only have special meaning if the webapp wants them to have special meaning. There's no actual "directory" in a URL.
Sometimes a URL may be parsed by the webapp and part of the URL is then applied as an internal resource path (for example, "images/pic1.jpg"), but that's only because the webapp decided to map things that way. It could have done something entirely different with the URL if it wanted to.
The h:link element is new to JSF2. I'm not quite sure what it does that the older hutputLink tag didn't, although I suspect that it may have to do with the ability to add parameter options to the resulting URL as well as the fact that it can accept JSF navigation targets for their "outcome".
Relative link locations can be tricky in J2EE, but JSF can make that better because it allows you to use absolute locations, instead. Normally to get the true URL of a J2Ee resource, you'd have to know the context path that the app was deployed under, but by using this feature, you can code a portable path. For example:
Notice that this is an "absolute" location because it begins with "/" instead of ".."
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 16, 2010
Thank you very much for this clear information, I have to mention that I am not an experienced programmer, and this is how I learn.
yea as you said, when I removed ../, and tried with absolute URLs, it is perfectly working.