我正在研究JSF 2.0 使用tomcat 6.0.26
当启动一个简单的页面时,h:commandButton没有显示,而浏览器中的html源显示<h:commandbutton value="Click (Good)" action="successful-test"></h:commandbutton>
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head><title>JSF 2.0: Server Test</title>
<link href="./css/styles.css"
rel="stylesheet" type="text/css"/>
</h:head>
<h:body>
<div align="center">
<table border="5">
<tr><th class="title">JSF 2.0: Server Test</th></tr>
</table>
<p/>
<h:form>
<fieldset>
<legend>Valid action</legend>
Click button. You should get success page.<br/>
<h:commandButton value="Click (Good)" action="successful-test" />
</fieldset>
<p/>
<fieldset>
<legend>Invalid action</legend>
Click button. You should get error message about not being
able to find matching navigation case.<br/>
<h:commandButton value="Click (Bad)" action="bogus-outcome" />
</fieldset>
</h:form>
</div></h:body></html>
运行tomcat后的html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head><title>JSF 2.0: Server Test</title>
<link href="./css/styles.css"
rel="stylesheet" type="text/css"/>
</h:head>
<h:body>
<div align="center">
<table border="5">
<tr><th class="title">JSF 2.0: Server Test</th></tr>
</table>
<p/>
<h:form>
<fieldset>
<legend>Valid action</legend>
Click button. You should get success page.<br/>
<h:commandButton value="Click (Good)" action="successful-test" />
</fieldset>
<p/>
<fieldset>
<legend>Invalid action</legend>
Click button. You should get error message about not being
able to find matching navigation case.<br/>
<h:commandButton value="Click (Bad)" action="bogus-outcome" />
</fieldset>
</h:form>
</div></h:body></html>
会发生什么?
答案 0 :(得分:0)
显然,什么也没发生。您的配置有问题。 Tomcat根本不解析JSF代码而只是逐字地返回它。
请发布您的web.xml配置。