Use the <f:view> tag.
I hope the below reference will help you find out the way out of this. (For me it worked and solved the same problem you had)
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<f:view>
<h:head>
<title><ui:insert name="title">Insert Title</ui:insert></title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link type="text/css" rel="stylesheet"
href="/JSF2nFacelets/theme/redmond/skin.css" />
</h:head>
<h:body>
<h:form id="form">
<h:panelGrid columns="3">
<h:outputText value="Keyup: " />
<p:inputText id="counter">
<f:ajax event="keyup" update="out" listener="#{counterBean.increment}" render="out" />
</p:inputText>
<h:outputText id="out" value="#{counterBean.count}" />
<br />
<h:messages />
</h:panelGrid>
</h:form>
</h:body>
</f:view>
</body>
</html>