Tôi đang cố thực hiện chuyển hướng từ index.xhtml sang registerFirstTime.xhtml.Làm thế nào để gọi một nút lệnh mà không xác nhận tất cả các đầu vào cần thiết?
Mã trong index.xhtml trang là:
<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>
Trong khi, nội dung của chuyển hướng, trong faces-config.xml, là:
<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>
Cho đến khi tên đầu vào và mật khẩu được điền, bạn không thể thực hiện chuyển hướng. Làm cách nào tôi có thể thực hiện chuyển hướng bản ghi mà không tính đến các trường bắt buộc? Cảm ơn! =)
Ý của bạn là chuyển hướng khi gửi mà không điền giá trị? – NaaN
Có, tôi cần phải thực hiện một giá trị điền đầy chuyển hướng (đăng nhập), nhưng tôi cũng cần các giá trị điền không có chuyển hướng (đăng ký) khác. –
Tôi đã chứng minh để đặt h: commandButton trong một h: hình thức, và nó hoạt động, nhưng là có bất kỳ có thể để đặt h: commandButton trong h: form với nội dung id? –