如何选择在JSF 2中加载哪种表单?

时间:2015-04-07 10:19:59

标签: jsf

我想构建一个在其页面上有多个表单的JSF应用程序。

我有2个XHTML页面:first.xhtml和second.xhtml(登录和注册)。

当我加载first.xhtml时,我希望它有“gotoAnotherPage”按钮 only ,这将重定向到second.xhtml,然后我想返回first.xhtml但是要加载“form2”而不是“form1”。

我想返回first.xhtml而不是去第三页,因为我想在first.xhtml上有其他表单,我不想复制这些附加表单的代码。

<h:form id="form1">
    <h:commandButton id="f1ID"
                     value="goTOAnotherPage"
                     action="goTOAnotherPage" >
    </h:commandButton>
</h:form>

<h:form id="form2">
    <h:outputText value = "in form 2" />
</h:form>

请帮助我,

谢谢。

0 个答案:

没有答案