我有一个html页面(editprofile.xhtml),它显示了保存在数据库中的数据。我面临的问题是,当我在屏幕上编辑一些数据并单击更新按钮时,编辑的数据不会发送到bean,它的值为null,从而导致错误。用户输入的数据未在托管bean中更新
<h:form id="editProfileForm">
<f:facet name="label">
<h:outputText value="Edit User Profile" />
</f:facet>
<rich:panel header="Edit User Profile" style="font-size:10pt" >
<rich:simpleTogglePanel switchType="client" opened="true">
<f:facet name="header">Registration Details</f:facet>
<table>
<tbody>
<tr>
<td>Login Name</td>
<td>
<h:inputText size="15" id="loginName" required="true"
value="#{EditUserProfileBean.loginName}">
<rich:ajaxValidator event="onblur" />
</h:inputText>
</td>
<td></td>
<td>Password</td>
<td><h:inputSecret size="12" id="password" required="true"
value="#{EditUserProfileBean.password}" >
<rich:ajaxValidator event="onblur" />
</h:inputSecret>
</td>
<td>Confirm Password</td>
<td><h:inputSecret size="12" id="confirmpassword" required="true"
value="#{EditUserProfileBean.confirmpassword}" >
<rich:ajaxValidator event="onblur" />
</h:inputSecret>
</td>
</tr>
</rich:simpleTogglePanel>
<h:commandButton id="editProfile" action="#{EditUserProfileBean.saveEditProfileAction}" immediate="true" value="Update Profile" />
</rich:panel>
</h:form>
上述页面充满了负载现有的数据,但如果我编辑和更新说的价值是被空
您是否在bean中定义了要传递属性的setter?此代码片段是否在表单中?代码在哪里提交表单,还是Ajax? – JMelnik 2012-04-13 06:22:44
请注意我的更新 – Mango 2012-04-13 06:42:29
尝试从commandButton中删除immediate =“true”。 – JMelnik 2012-04-13 06:44:50