开发者

Following the netbeans 6.8 JSF tutorial, form not displaying

As per title. I'm following the JavaServer Faces 2.0 tutorial (found here) - search for "To declare these components" to find roughly where I'm at.

Everthing works up until a certain point, however when I'm told to comment out the html form component, and uncomment the JSF form component, nothing displays. If I recomment out the JSF form and use the html one instead, it works fine. As far as I can see, I've followed the tutorial exactly. Any ideas?

For the record, this is what my index.xhtml looks like:

<!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">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
    <!--<h:outputStylesheet name="css/stylesheet.css" />-->

    <title>Greeting</title>
</head>

<body>
    <div id="mainContainer">

        <div id="left" class="subContainer greyBox">

            <h4>Hi, my name is Duke!</h4>

            <h5>I'm thinking of a number

                <br/>
                between
                <span class="highlight">1</span> and
                <span class="highlight">10</span>.</h5>

            <h5>Can you guess it?</h5>

            <!--<form action="response.xhtml">
                <input type="text" size="2" maxlength="2" />
                <input type="submit" value="submit" />
            </form>-->
            <h:form>
         开发者_JAVA技巧       <h:inputText size="2" maxlength="2" value="#{UserNumberBean.userNumber}" />
                <h:commandButton id="submit" value="submit" action="response" />
            </h:form>
        </div>

        <div id="right" class="subContainer">

            <img src="duke.png" alt="Duke waving" />
            <!--<h:graphicImage url="/duke.png" alt="Duke waving" />-->

        </div>
    </div>
</body>


make sure that your web.xml says: <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜