1

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>
user1285928
  • 1,140
  • 26
  • 93
  • 143

1 Answers1

4

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

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>

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

See also:

When should I use h:outputLink instead of h:commandLink?

Community
  • 1
  • 1
Elias Dorneles
  • 20,592
  • 10
  • 76
  • 100