JSF command button is not compile
Hi im studying JSF 2.0 Using tomcat 6.0.26
When a start a simple page the h:commandButton doesnt displayed, and the html source in browser display <h:commandbutton value="Click (Good)" action="successful-test"></h:commandbutton>
The code:
<!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>
the html code after tomcat running:
<!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>
what happen?
Apparently, nothing happened. There's something wrong with your configuration. Tomcat is not parsing the JSF code at all and just returning it verbatim.
Please post your web.xml configuration.
精彩评论