I am trying to put up 2 primeFaces panelGrid boxes, one for an existing user and one for a new user. I noticed that it stopped hitting my break points and I couldn’t figure out what happened. I started to cut things out of the source code until it started to work again.
I found a most strange thing which completely puzzles me and I would appreciate any hints someone can give me. The backing bean has mostly getters and setters and just the very beginnings of logic to check the login (essentially nothing at this stage). The xhtml file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Shalom Elias</title>
</h:head>
<h:body>
<h:form id="form">
Shalom
<h:panelGroup id="login" rendered="#{backing.renderPage(1)}">
<p:panelGrid id="knownUser" columns="2">
<f:facet name="header">
Registered User
</f:facet>
<h:outputLabel for="zehut1" value="ID" />
<p:inputText value="#{backing.buyer.tudatZehut1}" label="ID" id="zehut1" />
<h:outputLabel for="pass1" value="Password" />
<p:password value="#{backing.buyer.passWrd1}" label="Password" id="pass1" />
<f:facet name="footer">
<p:commandButton type="submit" value="Login" actionListener="#{backing.checkLogin}" />
</f:facet>
</p:panelGrid>
<p:spacer height="2" />
<p:panelGrid id="newUser" columns="4">
<f:facet name="header">
New User
</f:facet>
<p:inputText value="12345" />
</p:panelGrid>
</h:panelGroup>
<h:panelGroup id="buyer" rendered="false">
yet again
</h:panelGroup>
</h:form>
</h:body>
</html>
The breakpoint is in panelGrid knownUser in the footer section, in the commandButton. I chopped out all the original code and left one inputText box for the newUser panelGrid. Here is the kicker: if I put value=”12345″ for the initial value and press the command button, it will indeed hit the break point. However if I put value=”” or value pointing to a backing bean value which is currently blank, it will NOT hit the break point.
Since the purpose is for an existing user to log in, it isn’t acceptable to force him to fill in information which isn’t relevant to him. More important, why should it make any difference anyhow, if there is information in the panel grid which isn’t connected to the command button I am pressing? I am assuming it is legal to have 2 panel grids showing at the same time? In any case, I would appreciate any suggestions as to what could be wrong.
Thanks,
Ilan
The reason might be that validation or conversion fails. Then your listener will not be reached. Put a
h:messagestag somewhere on your page to see if that is the case. The tag will display conversion and validation errors.