0

按照标题。我正在关注 JavaServer Faces 2.0 教程(在此处找到) - 搜索“声明这些组件”以大致找到我所在的位置。

Everthing 一直工作到某一点,但是当我被告知注释掉 html 表单组件并取消注释 JSF 表单组件时,什么都没有显示。如果我推荐 JSF 表单并改用 html 表单,它可以正常工作。据我所知,我完全按照教程进行了操作。有任何想法吗?

作为记录,这就是我的 index.xhtml 的样子:

<!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>
                <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>

4

1 回答 1

0

确保您的 web.xml 显示: <welcome-file-list> <welcome-file> faces /index.xhtml</welcome-file> </welcome-file-list>

于 2010-02-24T00:05:23.043 回答