• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setter Methods are not being called

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Folks

I have a customer search page in which they can search for ,regular customers,Business Customers or Govt Customers. When I search for Some regular customer the setter methods are called but when i search for business and govt customer the setter methods are not being called.
We use the tomhawk faces.

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

facesConfig

<managed-bean>
<managed-bean-name>customerSearchBean</managed-bean-name>
<managed-bean class>us.tn.state.trust.presentation.beans.CustomerSearchBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>

Here is my jsp Page

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table>
<tr>
<td colspan="2">
<h:panelGroup>
<h:message for="indvFrstNme" errorClass="error"></h:message>
<h:message for="busNme" errorClass="error"></h:message>
<h:message for="govtNme" errorClass="error"></h:message>
</h:panelGroup>
</td>
<td colspan="2">
<h:panelGroup>
<h:message for="indvMidNme" errorClass="error"></h:message>
<h:message for="busFein" errorClass="error"></h:message>
<h:message for="govtLvlCde" errorClass="error"></h:message>
</h:panelGroup>
</td>
</tr>
<tr>
<td>
<h:outputText value="#{messages.customerSearch_indvFrstNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
<h:outputText value="#{messages.customerSearch_busNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></h:outputText>
<h:outputText value="#{messages.customerSearch_govtNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isGovernment}"></h:outputText>
</td>
<td>
<h:inputText id="indvFrstNme" size="10" maxlength="25" value="#{customerSearchBean.indvFrstNme}" rendered="#{customerSearchBean.isIndividual}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
<h:inputText id="busNme" size="10" maxlength="60" value="#{customerSearchBean.busNme}" rendered="#{customerSearchBean.isBusiness}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+" ></t:validateRegExpr>
</h:inputText>
<h:inputText id="govtNme" size="10" maxlength="60" value="#{customerSearchBean.govtNme}" rendered="#{customerSearchBean.isGovernment}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
</td>
<td>
<h:outputText value="#{messages.customerSearch_indvMidNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
<h:outputText value="#{messages.customerSearch_busFein}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></h:outputText>
<h:outputText value="#{messages.customerSearch_govtLvlCde}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isGovernment}"></h:outputText>
</td>
<td>
<h:inputText id="indvMidNme" size="10" maxlength="25" value="#{customerSearchBean.indvMidNme}" rendered="#{customerSearchBean.isIndividual}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+" ></t:validateRegExpr>
</h:inputText>
<h:inputText id="busFein" size="10" maxlength="9" value="#{customerSearchBean.busFein}" rendered="#{customerSearchBean.isBusiness}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
<h:selectOneMenu id="levelCode" value="#{customerSearchBean.govtLvlCde}" rendered="#{customerSearchBean.isGovernment}" styleClass="labelTextBlack">
<f:selectItems value="#{customerSearchBean.levelCodeList}"/>
<a4j:support event="onchange" action="#{customerSearchBean.changeGovernmentLevel}" ></a4j:support>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td colspan="2">
<h:message for="indvLastNme" errorClass="error"></h:message>
</td>
<td colspan="2">
<h:message for="indvNmeSfx" errorClass="error"></h:message>
</td>
</tr>
<tr>
<td>
<h:outputText value="#{messages.customerSearch_indvLastNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
</td>
<td>
<h:inputText id="indvLastNme" size="10" maxlength="40" value="#{customerSearchBean.indvLastNme}" rendered="#{customerSearchBean.isIndividual}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
</td>
<td>
<h:outputText value="#{messages.customerSearch_indvNmeSfx}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
</td>
<td>
<h:inputText id="indvNmeSfx" size="10" maxlength="3" value="#{customerSearchBean.indvNmeSfx}" rendered="#{customerSearchBean.isIndividual}"></h:inputText>
</td>
</tr>
<tr>
<td colspan="2">
<h:panelGroup>
<h:message for="indvDrvrLicNbr" errorClass="error"></h:message>
<h:message for="busLicNbr" errorClass="error"></h:message>
</h:panelGroup>
</td>
<td colspan="2">
<h:panelGroup>
<h:message for="drvrLicStCde" errorClass="error"></h:message>
<h:message for="busSaleTaxNbr" errorClass="error"></h:message>
</h:panelGroup>
</td>
</tr>
<tr>
<td>
<h:outputText value="#{messages.customerSearch_indvDrvrLicNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
<h:outputText value="#{messages.customerSearch_busLicNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></h:outputText>
</td>
<td>
<h:inputText id="indvDrvrLicNbr" size="10" maxlength="25" value="#{customerSearchBean.indvDrvrLicNbr}" rendered="#{customerSearchBean.isIndividual}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
<h:inputText id="busLicNbr" size="10" maxlength="12" value="#{customerSearchBean.busLicNbr}" rendered="#{customerSearchBean.isBusiness}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
</td>
<td>
<h:outputText value="#{messages.customerSearch_drvrLicStCde}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></h:outputText>
<h:outputText value="#{messages.customerSearch_busSaleTaxNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></h:outputText>
</td>
<td>
<h:selectOneMenu id="drvrLicStCde" value="#{customerSearchBean.drvrLicStCde}" rendered="#{customerSearchBean.isIndividual}" styleClass="labelTextBlack">
<f:selectItems value="#{statesBean.stateList}" />
</h:selectOneMenu>
<h:inputText id="busSaleTaxNbr" size="10" maxlength="12" value="#{customerSearchBean.busSaleTaxNbr}" rendered="#{customerSearchBean.isBusiness}">
<t:validateRegExpr pattern="[a-zA-Z0-9]+"></t:validateRegExpr>
</h:inputText>
</td>
</tr>
</table>
</td>
</tr>
</table>
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

According to the JSF lifecycle if there is an error at validation phase or conversion phase, then setter wont get called.
 
Surendra Poranki
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to debug these kind of issues its really hard to find if theres some thing wrong with the JSF page.
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Surendra,

Please let me know if you got the solution. I am also being stuck to the similar problem that you came across.


thanks
Benson
 
Ranch Hand
Posts: 121
Mac Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I am also facing the same problem, I am not seeing any problem in JSF page, but setter is not calling.
if one found solution please let me know.
 
Saloon Keeper
Posts: 27796
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Surendra, your example is very hard to read. The JavaRanch message editor has a button labelled "Code" that can be used to generate wrapper tags. If you use that, it won't chew up things.

A useful trick in JSF to debug validation problems is to put an "h:messages" tag up at the top of the view so that all the generated messages will display. Make sure you have the "globalonly" attribute set to false, so that the per-field messages display as well as the general messages.
 
reply
    Bookmark Topic Watch Topic
  • New Topic