我正在使用这样的 p:tab 视图
<ui:composition template="./WEB-INF/templates/masterTemplate.xhtml">
<ui:define name="windowTitle">
#{msgs.home}
</ui:define>
<ui:define name="content">
<p:tabView id="tabView" dynamic="false">
<p:tab id="tab1" title="#{msgs.home}">
<ui:include src="/homePages/home.xhtml" />
</p:tab> <!--end of tab1 -->
<p:tab id="tab2" title="#{msgs.join}">
<ui:include src="/homePages/join.xhtml" />
</p:tab> <!--end of tab2 -->
<p:tab id="tab3" title="#{msgs.signIn}">
<ui:include src="/homePages/login.xhtml" />
</p:tab> <!--end of tab3 -->
</p:tabView>
</ui:define>
</ui:composition>
这是我的 join.xhtml 页面
<h:body>
<ui:composition>
<div id="join" style="border-style:solid; border-width:5px; padding: 10px;" >
<div id="joinFormPosition" class="left">
<h:form id="joinForm">
<h:outputText id="joinMessgae" value="#{msgs.joinMessgae}" />
<span class="asterisk">*</span><span class="labels">#{msgs.signInName}: </span>
<p:inputText id="name"
value="#{joinPage.signInName}"
required="true"/>
<p:message for="name" />
...
<div id="submitButton">
<h:commandButton id="submitBtn"
value="Submit"
actionListener="#{join.saveUser}" />
</div>
</h:form>
</div> <!--end of joinFormPosition -->
</div> <!--end of join -->
</ui:composition>
</h:body>
登录.xhtml
<ui:composition>
<div id="login" style="border-style:solid; border-width:5px; padding: 10px;" >
<div id="loginFormPosition" class="left">
<h:form id="loginForm">
<h:outputText value="#{msgs.signIn}" />
.....
<div id="signInButton">
<h:commandButton id="signInBtn"
value="Submit"
actionListener="#{login.signIn}"
action ="#{login.outcome}"/>
</div>
</h:form>
</div> <!--end of loginFormPosition -->
</div> <!--end of login -->
</ui:composition>
如果我在选项卡加入,然后提交表单,如果任何验证失败,那么我切换到第一个选项卡。我希望如果我单击提交按钮并且验证是否失败,我会留在同一个选项卡上。我在登录选项卡上面临同样的情况。提交表单后如何保持在同一个选项卡上?
谢谢