JSF commandButton不调用操作

时间:2020-05-03 13:39:26

标签: jsf action jsf-2.2 commandbutton

我是JSF的新手,我从luv2code的教程开始。这是视频的链接:LINK

因此,设置最新的Eclipse和Tomcat。 我使用JSF 2.2.8来紧跟本教程。

在本教程中,生成了两个xhtml文件:

hello-world.xhtml:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:a="http://xmlns.jcp.org/jsf/passthrough">

    <h:head>
        <title>Hello World - Input Form</title>
    </h:head>
    <h:body>
        <h:inputText id="name" value="#{theUserName}"
            a:placeholder="What's your name?"/>
            <h:commandButton value="Submit" action="myresponse"/>
    </h:body>

</html>

myresponse.xhtml

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html">

    <h:head>
        <title>Hello World - Response</title>
    </h:head>
    <h:body>
        Hello, #{theUserName}
    </h:body>

</html>

一切正常,并且Eclipse浏览器中显示hello-world页面。但是,当我单击“提交”时,没有任何反应。

我做错了什么?

感谢帮助!

0 个答案:

没有答案
相关问题