我有以下问题,我在任何地方都找不到解决方案。
我有以下代码:
<h:inputText id="username" value="#{registrationBB.userName}" binding="#{userNameToConfirm}"/>然后:
<h:inputSecret id="confirmed-password" value="#{registrationBB.userPasswordConfirmed}">
<f:validator validatorId="usernameNotInPasswordValidator"/>
<f:attribute name="username" value="#{userNameToConfirm.value}" />
</h:inputSecret>inputText被绑定到#{userNameToConfirm} (这不是任何backingbean中的属性),稍后在密码验证器中使用此绑定。
这一切都运行得很好。
但是,这些字段所在的表单包含一个“重置”按钮,该按钮应该清空表单上的所有字段。
当单击reset按钮时,registrationBB中的所有属性都将清空,并调用以下代码:
getViewRoot().getChildren().clear();但是,用户名永远不会为空,因为它将始终由"#userNameToConfirm“绑定中的值设置。
我的问题是:如何访问此绑定并在faces后端中删除?
我们使用jsf版本1.2。
问候你,阿拉什
发布于 2012-05-24 20:56:14
而是让重置按钮重新加载页面。
<h:commandButton value="Reset" onclick="location.reload(true)" />或者使用带有<redirect>的<navigation-case>。
<h:commandButton value="Reset" action="reloadPagename" />使用
<navigation-rule>
<navigation-case>
<from-outcome>reloadPagename</from-outcome>
<to-view-id>/pagename.jsf</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>https://stackoverflow.com/questions/10735054
复制相似问题