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
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.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Aug 09, 2004
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?