在我点击页面中的“保存”后引入验证后,没有任何反应。 在页面中,我有“保存”和“取消”。我将“immediate = true”设置为取消按钮,这样就不会执行任何验证并返回上一个视图。 当我点击保存时,执行验证并正确显示错误,但是如果/当我输入正确的输入(以便验证没有错误),而不是处理数据并返回到上一页,没有任何反应...
我错过了什么吗?
这里有一些代码片段:
查看:
<f:metadata>
<f:viewParam name="mode" value="#{roomDetailController.model.mode}"/>
<f:viewParam name="dbId" value="#{roomDetailController.model.dbId}"/>
<f:event listener="#{roomDetailController.processCommand}" type="preRenderView"/>
</f:metadata>
...
<tr>
<td>
<h:outputLabel value="#{msg.roomFormFieldRoomName}:"/>
</td>
<td>
<h:inputText id="roomName" value="#{detailModel.afterObject.roomName}" disabled="#{detailModel.mode == detailModel.viewMode}">
<f:validateBean/>
</h:inputText>
<h:message for="roomName" style="color:red"/><br/>
</td>
</tr>
<tr>
<td>
<h:outputLabel value="#{msg.roomFormFieldRoomIPs}:"/>
</td>
<td>
<h:inputText id="roomIPs" value="#{detailModel.afterObject.roomIPs}" disabled="#{detailModel.mode == detailModel.viewMode}">
<f:validateBean/>
</h:inputText>
<h:message for="roomIPs" style="color:red"/><br/>
</td>
</tr>
...
<!-- SUBMIT BUTTON -->
<h:commandButton
styleClass = "waiButton"
value = "#{commonButtonSubmit}"
action = "#{detailController.submitAction()}"
rendered = "#{detailModel.mode != detailModel.viewMode}"
/>
<!-- CANCEL BUTTON -->
<h:commandButton
styleClass = "waiButton"
value = "#{commonButtonCancel}"
action = "#{detailController.cancelAction()}"
immediate = "true"
rendered = "#{detailModel.mode == detailModel.cancelMode or detailModel.mode == detailModel.editMode or detailModel.mode == detailModel.multiEditMode or detailModel.mode == detailModel.createMode}"
/>
...
控制器:
...
// Action: "submit" clicked
public String submitAction()
{
detailModel.setCommand( DetailModel.Command.SUBMIT );
return null;
}
// Action: "cancel" clicked
public String cancelAction()
{
if ( detailModel.getEditMode().equals( detailModel.getMode() ) )
{
detailModel.setMode( detailModel.getViewMode() );
return null;
}
else
{
// Multi Edit Mode
return appendUrlParameter( getListViewName(), FACES_REDIRECT_TRUE );
}
}
...
如果您需要更多信息,请告诉我......
答案 0 :(得分:0)
问题解决了。如上所述它与验证无关。