aspose file tools*
The moose likes JSF and the fly likes Setter Methods are not being called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Setter Methods are not being called" Watch "Setter Methods are not being called" New topic
Author

Setter Methods are not being called

Surendra Poranki
Greenhorn

Joined: May 16, 2004
Posts: 5
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>
<hutputText value="#{messages.customerSearch_indvFrstNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
<hutputText value="#{messages.customerSearch_busNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></hutputText>
<hutputText value="#{messages.customerSearch_govtNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isGovernment}"></hutputText>
</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>
<hutputText value="#{messages.customerSearch_indvMidNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
<hutputText value="#{messages.customerSearch_busFein}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></hutputText>
<hutputText value="#{messages.customerSearch_govtLvlCde}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isGovernment}"></hutputText>
</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>
<hutputText value="#{messages.customerSearch_indvLastNme}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
</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>
<hutputText value="#{messages.customerSearch_indvNmeSfx}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
</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>
<hutputText value="#{messages.customerSearch_indvDrvrLicNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
<hutputText value="#{messages.customerSearch_busLicNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></hutputText>
</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>
<hutputText value="#{messages.customerSearch_drvrLicStCde}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isIndividual}"></hutputText>
<hutputText value="#{messages.customerSearch_busSaleTaxNbr}" styleClass="labelTextBlackBold" rendered="#{customerSearchBean.isBusiness}"></hutputText>
</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>
Tushar Kherde
Ranch Hand

Joined: Apr 28, 2006
Posts: 56
Hi,

According to the JSF lifecycle if there is an error at validation phase or conversion phase, then setter wont get called.


Tushar
Surendra Poranki
Greenhorn

Joined: May 16, 2004
Posts: 5
Is there a way to debug these kind of issues its really hard to find if theres some thing wrong with the JSF page.
Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 207
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
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

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.


Sun Certified Java Programmer with 93 percent
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setter Methods are not being called