如果代码是这样的,我无法重定向到另一个页面:
<h:commandButton type="button" value="Enter" action="index?faces-redirect=true" >
但如果代码是,则重定向有效:
<h:commandButton type="button" value="Enter" action="index?faces-redirect=true" >
<f:ajax />
</h:commandButton>
谁能解释一下?谢谢!
- - - - - - - - - - - -编辑 - - - - - - - - - - - -
整个 xhtml 代码供您参考:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form id="form">
<h:commandButton id="enterModelButton" type="button" value="Enter" action="index?faces-redirect=true" >
<f:ajax />
</h:commandButton>
</h:form>
</h:body>
</html>