1

我想在 JSF 页面中创建命令按钮。当我按下它时,我想打开一个新页面并使用 http 发送一个值。我对此进行了测试,h:commnadButton但它不起作用。

<h:commandButton id="lnkHidden" value=" Edit User " action="EditAccountProfile.jsf">
 <f:param name="id" value="#{item.userid}" />
</h:commandButton>
4

1 回答 1

4

h:commandButton用于提交表单,通常在服务器中执行操作。

用于h:button简单导航:

<h:button id="lnkHidden" value=" Edit User " outcome="EditAccountProfile.jsf">
 <f:param name="id" value="#{item.userid}" />
</h:button>

这将生成一个普通的 HTML <input type="button" onclick="window.location.href=/correct/path/to/EditAccountProfile.jsf" />,不需要 HTTP POST。

也可以看看:

什么时候应该使用 h:outputLink 而不是 h:commandLink?

于 2012-07-26T13:25:11.947 回答