我在从 Javascript 加载 Facelets 页面时遇到问题。我正在使用 Netbeans 7.2、Glassfish 3.1.2 和 Java EE 6。
我做了一个简单的测试页面:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<script type="text/javascript">
window.location.href = "index.xhtml";
</script>
<title>winq match!</title>
</h:head>
<h:body>
<h1>WING MATCH!!</h1>
<h:form>
<h:commandButton id="Next" value="weiter" action="index"/>
</h:form>
</h:body>
index.xhtml
应该加载的页面window.location.href
是:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:outputText value="TestTestTestTestTest"/>
msg <h:inputText id="ema" value="#{testBean.inputValue}" maxlength="1" />
<h:commandButton id="but" value="Submit" action="index"/>
</h:form>
</h:body>
页面已加载但未解析,因此h:
浏览器不会解释标签。在网上搜索后,似乎我是唯一一个遇到这种问题的人。也许我误解了 JSF 的某些方面。我希望能得到一些建议。