如何在JSF中创建h:commandButton来打开新页面 [英] How to create h:commandButton in JSF to open a new page

查看:105
本文介绍了如何在JSF中创建h:commandButton来打开新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to create command button in JSF page. When I press it I want to open a new page and send a value using using the http. I tested this h:commnadButton but it's not working.

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

推荐答案

h:commandButton is for submitting forms, usually executing actions in the server.

使用 h:button 用于简单导航:

Use h:button for simple navigation:

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

This will generate a normal HTML <input type="button" onclick="window.location.href=/correct/path/to/EditAccountProfile.jsf" />, no HTTP POST needed.

另请参见:

何时应使用h:outputLink代替h:commandLink?

这篇关于如何在JSF中创建h:commandButton来打开新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆