aspose file tools*
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
Author

JSF, Facelets and paths inside javascript file

Marcin Kurek
Greenhorn

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 http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/, 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:
<navigation-rule>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/home.xhtml</to-view-id>
</navigation-case>

<navigation-case>
<from-outcome>about</from-outcome>
<to-view-id>/about.xhtml</to-view-id>
</navigation-case>
</navigation-rule>


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

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?
 
 
subject: JSF, Facelets and paths inside javascript file