File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF, Facelets and paths inside javascript file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF, Facelets and paths inside javascript file" Watch "JSF, Facelets and paths inside javascript file" New topic

JSF, Facelets and paths inside javascript file

Marcin Kurek

Joined: May 11, 2008
Posts: 8
Hi there,

I am developing a simple application using JSF and Facelets, running on Apache Tomcat 6. At the main page I'm using nice JQuery based menu, found at, which is the root of the problem.
Directory structure is as follows:

The problem is that these small arrows next to menu labels show up ONLY when I invoke application using http://localhost:8080/webapp address. Typing in http://localhost:8080/webapp/faces/home.xhtml brings home.xhtml page, jquery menu works fine, but arrows could not be loaded. As far as I know, when I type in http://localhost:8080/webapp the index.jsp is loaded. Because of <jsp:forward page="/faces/home.xhtml"/> request is redirected to JSF servlet, and in turn, http://localhost:8080/webapp/faces/home.xhtml is loaded (However, I'm not sure when exactly Facelets come to play).
So, at the first glance, the result of both operations should be identical, but it isn't. How could it be?
I think that possible cause of the problem may be the following line in menu's js file:
var arrowimages={down:['downarrowclass', "img/down.gif", 23], right:['rightarrowclass', 'img/right.gif']}

This js file is included in template, on which home.xhtml is based:
<script src="#{facesContext.externalContext.requestContextPath}/js/jqueryslidemenu.js" type="text/javascript"></script>

I think that because of some actions I'm not aware of, the paths to images may be incorrectly interpreted.
Moreover, when I click on either link in my menu, situation is exactly the same - destination page is loaded, but the arrows are gone.

Navigation rules at faces-config.xml are as follows:


Thanks for reading, if something is unclear please post, I'll try to clarify.
[ November 17, 2008: Message edited by: Marcin Kurek ]
Stefan Bley

Joined: Nov 25, 2008
Posts: 2
Hi Marcin,

I guess the problem is the relative path to the image here:
At one time the browser looks for http://localhost:8080/webapp/img/down.gif and at the other time it looks for http://localhost:8080/webapp/faces/img/down.gif.

Have you found a solution yet?
I agree. Here's the link:
subject: JSF, Facelets and paths inside javascript file
Similar Threads
why the same URL shows different page in JSF
JSF with Weblogic 8.1 sp3
.jsp file becomes .jsf file?
Navigation Problem - URL not updated
Hide absolute navigation paths