Your're using JSF 2.0 and the file has a *.xhtml
extension. You're actually using Facelets as view technology, not JSP. Facelets is the successor of JSP. You cannot mix Facelets with JSP tags. Get rid of all <jsp:>
tags, they are worthless and ain't ever going to work in a Facelets page. The JSP tags are only parsed when you name the file *.jsp
which will be picked up by servletcontainer's builtin JspServlet
. But since you're using JSF 2.0 with Facelets, you already have the FacesServlet
for the job. Forget JSP :)
Here's how your XHTML file should look like:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Title</title>
</h:head>
<h:body>
<h:inputText value="#{userBean.id}"/>
</h:body>
</html>
Note that you'd like to put that input component in a <h:form>
, but I bet that it'll be just a test example.
Also note that <!DOCTYPE html>
is perfectly legit here. You don't need the XHTML doctype. Facelets will take care about setting the right text/html
content type, UTF-8
character encoding and so on.
See also: