Reputation: 6143
The following is my index.html
file which contains the JSF: http://pastie.org/3755252
When I choose Run as > Run on Server
(Tomcat 7.0.12) in Eclipse Indigo I get a page which says only the following:
You have login attempts left.
The same happens in Chrome. Although after looking at the source of the page, it displayed just as I have it written in Eclipse (the previous pastie file), but it seems like it should be translated to html.
This is my Member.java file: http://pastie.org/3755277 And here is my web.xml: http://pastie.org/3755284
It used to work, before I noticed I was mixing JSF 2.0 with JSF1.* syntax. Then I changed my *.jsp to *.html and it doesn't work.
Upvotes: 1
Views: 1357
Reputation: 8807
Pastie seems to be down (I can't read your files)... but Tomcat isn't a full Java EE container. You'd need the Mojarra runtime. Do you have that included in your build?
EDIT: NM it's back. I see the JSF servlet in your web.xml, so you may disregard this answer.
EDIT2: Add this to your web.xml:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
Then rename your .html files to .xhtml. I have a feeling the servlet didn't know it was supposed to render your files using JSF.
EDIT3: So I think what's happening is your confusing the server on whether or not it should render the page using Faces. You're URL in your url bar is "localhost/app/faces/index.html" which matches a file exactly. So should it do a sendfile or should it run it through the servlet? The reason why renaming to .xhtml likely worked was because internally it knew it had to map a .html request to a .xhtml file.
So maybe try renaming your files to .html5, then set this in your web.xml:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html5</param-value>
</context-param>
I think any extension will work... You could also do this combination:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html</param-value>
</context-param>
Then your home page would be http://localhost/app/index.jsf
Upvotes: 3