• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF application on Apacher web server and Tomcat

 
anyz mick
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF based web application using facelets (XHTML). It works perfect on Tomcat. For demo purpose i deployed it on hosting server that uses apache web server integrated with tomcat. As i acces any xhtml page in IE it opens the Save dialog box to save the file reather than display it. In FireFox it display the file but no XHTML tag is parsed. So i guess currently apache server is trying to serve xhtml itself rather than fwding to tomcat and XHTML extension is not recognized.

I need two things to configure:

1- Configure apache to foward .xhtml requests to tomcat
2- Configure tomcat to server .xhtml files

For first if added follwoing lines to .htaccess file ( i don't have access to httpd.conf in shared hosting)
AddType application/xhtml+xml .xhtml
AddHandler jserv-servlet .xhtml

but it does work. Could you please share you experience what configurations i need to make it work at both Apache server and application web.xml etc

Thanks
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid you're making the common mistake of confusing URLs with resource paths. Normally you wouldn't have an ".xhtml" extension on the URLs (I use ".jsf") and therefore there is no need to configure Apache to understand ".xhtml".

In any event, referencing the ".xhtml" resource directly doesn't work. You have to submit a JSF URL or the request won't be routed through the FacesServlet and the JSF processes won't be invoked - all it will do is return the xhtml source.

Also, it looks like you're not properly configured in the apache-to-Tomcat connector, since if you were, Apache wouldn't care about the extension on the URL - it would route all matching URLs to Tomcat.
 
anyz mick
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Tim.
Here is my FacesServlet mapping to serve xhtml in web.xml file:


and default suffix:


I do call xhtml files diretly e.g. http://myserver/myApp/login.xhtml.
I have links directly pointing to xhtml files. You are correct that FacesServlet is not capturing the xhtml URLs and source is returned back. But how can i fix it?
 
anyz mick
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSF 1.2 with rich faces. I followed similar thread at http://www.coderanch.com/t/500479/JSF/java/JSF-Facelets but even URL like http://myserver/myapp/login.jsf not works. My FacesServlet is defined to catch *.xhtml. And its working perfect on Tomcat. Not getting it up on my hosting that has Apache server at front and integrated with Tocmat.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!