我是一个有用的助手,可以为您翻译文本。
我试图从index.xhtml重定向到registerFirstTime.xhtml。
页面index.xhtml中的代码如下:
<h:form id="content" style="margin-top: 1em;">
<p:panel id="panel" header="LOGIN">
<p:messages id="msgs" globalOnly="true"/>
<h:panelGrid columns="3">
<h:outputLabel value="e-mail" />
<p:inputText id="name" required="true" value="#{UserBean.email}"
requiredMessage="Required: e-mail" display="icon">
</p:inputText>
<p:message id="msgName" for="name"/>
<h:outputLabel value="Password" />
<p:password id="password" required="true" value="#{UserBean.password}"
requiredMessage="Required: Password" display="icon" feedback="false">
</p:password>
<p:message id="msgPassword" for="password"/>
</h:panelGrid>
<h:panelGrid columns="2">
<p:commandButton value="Login" actionListener="#{UserBean.validate}" update="msgNombre, msgPassword, msgs"/>
<h:commandButton value="Register for the first time" action="register"/>
</h:panelGrid>
</p:panel>
</h:form>
然而,faces-config.xml 中重定向的内容是:
<navigation-rule>
<from-view-id>index.xhtml</from-view-id>
<navigation-case>
<from-outcome>register</from-outcome>
<to-view-id>registerFirstTime.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
在输入名称和密码之前,无法进行重定向操作。 请问如何在不考虑必填字段的情况下进行记录重定向?谢谢!=)