Primefaces password match unhandled message - primefaces

I'm trying to get Primefaces 3.5 password matching to work and I keep getting an error saying "There are some unhandled FacesMessages", and no proper message is displayed as expected.
I have created a very simple page and copy'n'pasted the code from the Showcase to try to eliminate all other possible causes, but the problem is still happening. Here is the very simple page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<title>Primefaces Password Match Test</title>
<link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/css/custom.css" />
</h:head>
<h:body>
<h:form id="form">
<p:panel header="Match Mode">
<p:messages id="messages" showDetail="true" autoUpdate="true"/>
<h:panelGrid columns="2" id="matchGrid">
<h:outputLabel for="pwd1" value="Password 1: *" />
<p:password id="pwd1" value="#{passwordBean.password5}" match="pwd2" label="Password 1" required="true"/>
<h:outputLabel for="pwd2" value="Password 2: *" />
<p:password id="pwd2" value="#{passwordBean.password5}" label="Password 2" required="true"/>
</h:panelGrid>
<p:commandButton id="saveButton" update="matchGrid" value="Save" />
</p:panel>
</h:form>
</h:body>
</html>
The bean I'm using is an exact copy of the Showcases bean.
This is what I see in the console after typing different passwords and clicking Save:
[14/05/13 12:41:02:481 EST] 000000ee srt W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[14/05/13 12:41:02:633 EST] 000000e8 srt W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.
[14/05/13 12:41:09:371 EST] 000000e9 RenderRespons W There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are:
- Password 1 should match with Password 2.
[14/05/13 12:41:09:352 EST] 000000e9 SystemErr R 10999369 [WebContainer : 1] INFO org.apache.bval.jsr303.ConfigurationImpl - ignoreXmlConfiguration == true

Instead of updating the matchGrid update the form.
use update=#form

Related

Tooltip as PrimeFaces component

I tried to have a modified tooltip component (basically to group some common properties), but I'm not able to show the tooltip as I do not know how to define for attribute.
As a MCVE I have this page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:comp="http://xmlns.jcp.org/jsf/composite/comp" >
<h:head>
<title>Component Test</title>
</h:head>
<h:body>
<h:form>
<comp:myInputText value="ABC" />
</h:form>
</h:body>
</html>
where comp: prefix is for custom components (in META-INF/resources/comp folder)
When my component is defined as:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html" xmlns:comp="http://xmlns.jcp.org/jsf/composite/comp">
<c:interface>
<c:attribute name="value" required="true" />
</c:interface>
<c:implementation>
<p:inputText id="text" value="#{cc.attrs.value}" />
<p:tooltip for="#previous" value="tooltip" />
</c:implementation>
</html>
everything is ok, so in next step I tried replace p:tooltip with comp:myTooltip, but it is not shown
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html" xmlns:comp="http://xmlns.jcp.org/jsf/composite/comp">
<c:interface>
<c:attribute name="value" required="true" />
</c:interface>
<c:implementation>
<p:inputText id="text" value="#{cc.attrs.value}" />
<comp:myTooltip forr="#previous" data="tooltip" />
</c:implementation>
</html>
Problem seems to me, that I'm not able to define for properly (I had to rename for to forr, just because for cannot be used).
I'm getting error:
Cannot find component for expression "#previous" referenced from "j_idt5:j_idt12:j_idt14:j_idt11".
I tried also to define id for inputText and use it in comp:myTooltip, it didn't work too...
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html" xmlns:comp="http://xmlns.jcp.org/jsf/composite/comp">
<c:interface>
<c:attribute name="value" required="true" />
</c:interface>
<c:implementation>
<p:inputText id="text" value="#{cc.attrs.value}" />
<comp:myTooltip forr="text" data="tooltip" />
</c:implementation>
</html>
Cannot find component for expression "text" referenced from "j_idt5:j_idt12:j_idt14:j_idt11".
edit (forgotten comp:myTooltip):
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html">
<c:interface>
<c:attribute name="forr" required="true" />
<c:attribute name="data" required="true" />
</c:interface>
<c:implementation>
<p:tooltip for="#{cc.attrs.forr}" position="right" value="#{cc.attrs.data}" />
</c:implementation>
</html>

Why do I get "Prefix h for element h:head is not bound" error? [duplicate]

This question already has answers here:
javax.faces.view.facelets.FaceletException: Error Parsing /my.xhtml: Error Traced[line: 42] The prefix "f" for element "f:facet" is not bound
(3 answers)
Closed 6 years ago.
Here's my xhtml file:
<html>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
</h:head>
<h:body>
<view>
<h:form>
<br/>
<br/>
<center>
<h:panelGrid columns="2">
<f:facet name="header">
<h:outputText value="Login"/>
</f:facet>
<h:outputText value="Benutzername:"/>
<h:inputText value="#{benutzer.benutzerName}" size="18"/>
<h:outputText value="Passwort: "/>
<h:inputSecret value="#{benutzer.passwort}" size="18"/>
<f:facet name="footer">
<h:commandButton value="Login" action ="#{benutzer.doLogin}"/>
</f:facet>
</h:panelGrid >
</center>
</h:form>
</view>
</h:body>
Every time I try to run it I get the error "prefix h for element h:head is not bound."
It's driving me crazy. Why do I get this error?
You need the h namespace
<!DOCTYPE HTML>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
...
</h:head>
<h:body>
...
</h:body>
</html>

primefaces p:commandButton update property fails to update p:messages component

I have a PrimeFaces <p:commandButton update=":messages" which doesn't display p:messages after sending the form, but if I use update="#all" instead it does update p:messages and I can see the messages displayed.
I've tried many other combinations such as update="messages", update="NewRegistryForm:messages", update="#form :messages", render=":messages"... but nothing else seems to work. Any idea why this might be happening?
On RegistryInputNewBean.processRequest I simply update the messages component like this:
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "error_processing_request")
);
mytemplate.xhtml, containing p:messages, is something like this:
<!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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
lang="en"
>
<f:view contentType="text/html" encoding="UTF-8" locale="en">
<h:head>
<title>test</title>
</h:head>
<h:body id="pageBody">
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" showSummary="false"/>
<ui:insert name="content" />
</h:body>
</f:view>
</html>
myform.xhtml is like this:
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<ui:define name="content">
<ui:composition template="mytemplate.xhtml">
<h:form id="NewRegistryForm">
<p:commandButton
id="sendButton"
type="submit"
action="#{registryInputNewBean.processRequest}"
update="#all"
style="display:none" />
</h:form>
</ui:composition>
</ui:define>
</html>
The p:messages is not inside a form, that is why the button is not going to update the component alone, only if you put #all, which refresh all the components in the page.
If you put another form that contain the p:message inside, you will be able to update the component with an update="fooForm:fooMessages"
you can update on the bean
Like
RequestContext rc = RequestContext.getCurrentInstance();
rc.update("id");

JSF Primefaces Mobile navigation

The scenario is a mobile page developed with JSF and Primeface Mobile.
I want to navigate in the same xhtml page between multiple pages. When I click a button in the main page the content must be loaded from managed bean in the second page. I followed this example http://www.primefaces.org/showcase/mobile/navigation.xhtml , but I can't navigate, I have the follow message 'No navigation case match for viewId mobile.xhtml, action #{myManagedBean.gotoSecond} and outcome pm:second'.
Here the xhtml code
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile">
<f:view renderKitId="PRIMEFACES_MOBILE" />
<h:head>
</h:head>
<h:body>
<pm:page id="first">
<pm:header title="Page 1"></pm:header>
<pm:content>
<h:form>
<p:commandButton value="Ajax Action" action="#{myManagedBean.gotoSecond}"/>
</h:form>
</pm:content>
</pm:page>
<pm:page id="second">
<pm:header title="Page 2"></pm:header>
<pm:content>
<p>Page 2 content.</p>
<p:button outcome="pm:first" value="Go Back" />
<h:form>
#{myManagedBean.hello}
</h:form>
</pm:content>
</pm:page>
</h:body>
</html>
And the managed bean method
public String gotoSecond(){
return "pm:second";
}
You need this in your faces config file:
<application>
<navigation-handler>
org.primefaces.mobile.application.MobileNavigationHandler
</navigation-handler>
</application>

Primefaces p:commandLink not working in p:datatTable

i just don't get it...
Why p:commandLink not working? The page is refreshing but with the same amount of data in table. I'm supposing that controller is okay. Take a look.\
View:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<body>
<ui:composition template="./Template.xhtml">
<ui:define name="content" >
<f:view>
<h:form style="padding: 5px">
<p:dataTable id="dataTable2" var="item" value="#{warningsController.warns}">
<p:column rendered="#{loginController.admin}">
<f:facet name="header">
<h:outputText value="Administracja" />
</f:facet>
<h:form>
<p:commandLink id="Remove" value="Remove" action="#{warningsController.remove(item.id)}" ajax="false" />
</h:form>
</p:column>
</p:dataTable>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</body>
</html>
and controller:
public String remove(long a){
//System.out.println(a);
pf.remove(pf.find(a));
return "Listsev.xhtml";
}
You have multiple h:forms cascaded/nested, that's invalid html. Unknown/wanted side effects can/may occur, maybe like you are experiencing right now. Get right if that inner h:form and try again.
In your remove method, pf is the list which you return by calling #{warningsController.warns}?