views:

503

answers:

1

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"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"&gt;
<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>
                <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>

A: 

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

gene s
Two weeks later I'm able to get back to looking at this -_-That fix seemed to do it :o, what did that change do exactly?
alex
I should add that, as you indicated, the text in the web.xml file was originally "<welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list>" - wondering why the tutorial would have it this way if it's wrong?
alex