[jboss-user] [Beginners Corner] - Problem with some attributes not being set in backingbean us

mzachara do-not-reply at jboss.com
Thu Oct 5 11:28:12 EDT 2006


I'm not quite sure which component could be causing problems, but i'm using jboss 4.0.4 with bundled tomcat and jsf-myfaces implementation, so i guess others could have come across this as well...

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) od submit, all previous data is sent to 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:

<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 doring the (1) phase, it doesnt work :(

the backing bean (managed bean) has scope: request

i've been wrestling with this for many hours now....
any help will be greatly appreciated
marek

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976330#3976330

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976330



More information about the jboss-user mailing list