Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
了解JSF操作_Jsf_Controller_Action - Fatal编程技术网

了解JSF操作

了解JSF操作,jsf,controller,action,Jsf,Controller,Action,我启动JSF 2,创建一个xhtml页面是index.xhtml,该页面有一个按钮: <h:commandButton value="Submit" action="welcome" /> 我真的没有看到要欢迎的链接或操作,在隐藏字段中,我看到了ViewState,但当我引用页面时,它会自动生成和更改。我也没有看到任何加载欢迎页面的JavaScript代码 在运行之后,我想,当第一次,jsf读取index.xhtml并显示它时,在提交之后,按下jsf读取index.xhtml并获取

我启动JSF 2,创建一个xhtml页面是index.xhtml,该页面有一个按钮:

<h:commandButton value="Submit" action="welcome" />
我真的没有看到要欢迎的链接或操作,在隐藏字段中,我看到了ViewState,但当我引用页面时,它会自动生成和更改。我也没有看到任何加载欢迎页面的JavaScript代码

在运行之后,我想,当第一次,jsf读取index.xhtml并显示它时,在提交之后,按下jsf读取index.xhtml并获取此按钮的操作并显示欢迎页面。

来自Mkyong站点-

在JSF 1.x中,您必须在“faces config.xml”中声明“导航规则”,以告诉单击按钮时显示哪个页面。在JSF 2.0中,您可以将页面名称直接放在按钮的“action”属性中。对于简单的导航来说,这已经足够了,但是对于复杂的导航,仍然建议您使用“faces config.xml”中的“导航规则”

我建议您阅读一些JSF 2的教程或购买书籍->

您确实看到了a和a,对吗?在深入研究JSF之前,您最好先学习一些。对于初学者来说:这种方法是糟糕的设计。相关:,和
<!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"><head></head><body lang="en">
<form id="j_idt5" name="j_idt5" method="post" action="/Test/index.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt5" value="j_idt5" />
<input type="submit" name="j_idt5:j_idt6" value="Submit" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-5517223312856481273:-1605099621977497303" autocomplete="off" />
</form></body> 
</html>