You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Marek Zachara <ma...@telperion.pl> on 2006/10/08 20:19:23 UTC
Problem with some attributes not being set in backingbean us
i'm having some probless with myfaces, and havnt been able
to find any help so far :(
I have a following scenario:
1) edit_company.jsp page with some h:inputText fields on submit,
2) a backing bean has several properties + setter/getter methods
3) backing bean performs some validation and returns control to the same
edit_company.jsf page, displaying error messages (if any)
4) if there are no error messages, additional inputText is displayed for the
user to supply his password to confirm changes
5) on submit, all previous data is sent to the backing bean plus also the
password submitted by user in the new field. Of course, the BB has
setter/getter method for the password as well
now the problem is: if i display the inputText field at step (1), even if its
empty and readonly - everything works fine. However, if i dont render this
inputText at (1), but only at second stage (4), then on submit (5), the
password is not transferred to the backing bean.
here is the relevant code of the jsp page:
Code:
<table>
<tr>
<td width="20%">Retailer UID: </td>
<td width="50%">
<h:inputText id="uid" size="20" dir="ltr"
value="#{companyEdit.uid}" readonly="#{companyEdit.confirmState}" />
</td>
<td width="30%"><h:message styleClass="errorMsg" for="uid" /></td>
</tr>
<tr>
<td>Name: </td>
<td>
<h:inputText id="nameE" size="40" dir="ltr"
value="#{companyEdit.nameE}" readonly="#{companyEdit.confirmState}" />
</td>
<td><h:message styleClass="errorMsg" for="nameE" /></td>
</tr>
<tr>
<td>Address: </td>
<td>
<h:inputTextarea id="address" rows="5" cols="40" dir="ltr"
value="#{companyEdit.address}" readonly="#{companyEdit.confirmState}" />
</td>
<td><h:message styleClass="errorMsg" for="address" /></td>
</tr>
<tr>
<td>
<h:outputText dir="ltr" value="Enter your password:"
rendered="#{companyEdit.confirmState}" />
</td>
<td>
<h:inputText id="confirmPass" size="40" dir="ltr"
value="#{companyEdit.pass}" rendered="#{companyEdit.entryState}" />
</td>
<td><h:message styleClass="errorMsg" for="confirmPass" /></td>
</tr>
<tr>
<td colspan="3" align="center">
<h:inputHidden value="#{companyEdit.confirmState}"
id="confirmS" />
<h:commandButton id="cancel" value="Cancel"
action="#{companyEdit.cancel}" />
<h:commandButton id="save" value="Save"
action="#{companyEdit.save}" />
</td>
</tr>
</table>
if i change:
<h:inputText id="confirmPass" size="40" dir="ltr"
value="#{companyEdit.pass}" rendered="#{companyEdit.entryState}" />
to:
<h:inputText id="confirmPass" size="40" dir="ltr"
value="#{companyEdit.pass}" readonly="#{companyEdit.entryState}" />
then everything works as expected. However without this component rendered
during the (1) phase, it doesnt work :( The backing bean has property pass
always equal to empty string (or whatever initialisation it had)
the backing bean (managed bean) has scope: request
i've been wrestling with this for a few days now....
any help will be greatly appreciated
marek