I'm starting a JSF project (this is the first time I've used JSF) and I'm having problems with the tags being rendered. I'm developing in Eclipse and using TomCat as a server.
My login.jsp file: https://gist.github.com/code-curve/e7e557262d407dddd1f3
My web.xml file: https://gist.github.com/code-curve/52902b7605b780dea93f
Eclipse project structure: http://snag.gy/P8Sts.jpg
Server startup log: https://gist.github.com/code-curve/d1927a636052607ce16a
I am accessing the file with this url: http://localhost:8080/DeutschAkademie/login.jsp and
as I understand the <h:form> tag should render as <form>, but instead it's instead rendering as <h:form>. Any ideas?
Two advices:
Update the URL pattern for Faces Servlet. The default configuration can be for *.jsp (no need to use *.faces or something else. Still, I would recommend using *.xhtml.
JSF 2 works with Facelets, so you don't need to use old JSP anymore. By reading your login.jsp page content, you can just rename the extension from jsp to xhtml and it will work.
Based on these, the web.xml will look like this:
<web-app>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
</web-app>
And having login.xhtml file.
To access to your page you will only need to write http://localhost:8080/DeutschAkademie/login.xhtml in your browser address bar.
Related:
EDIT:
Based on the picture of your project, the WEB-INF/lib folder is clean. You should drop the JSF 2 libraries there. Add them, recompile your project and try it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With