Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:11:50+00:00 2026-05-25T11:11:50+00:00

I read on other threads that this does not work: <h:commandButton value=Create New Account

  • 0

I read on other threads that this does not work:

<h:commandButton value="Create New Account" 
                action="#{acctBean.doCreate}" >
   <f:param name="acctName" value="#{acctBean.handle}" />
   <f:param name="acctNo" value="#{acctBean.id}" />
</h:commandButton>

The doCreate() method will return a navigation to a “congratulations” page if it creates the account. The target page can then resolve #{param.handle} and #{param.id}.

I know this will work if I use h:commandLink instead, but I want a button, not a link. Is there any generally accepted way of doing that?

UPDATE:

Based on the first answer from @BalusC I created the following test code:

<h:commandButton value="Push Me" action="goAcctCreated" >
    <f:param name="acctName" value="This Is Account Name" />
    <f:param name="acctNo" value="1234" />
</h:commandButton>
<h:button value="Push Me #2" outcome="newAcct" >
    <f:param name="acctName" value="This Is Account Name" />
    <f:param name="acctNo" value="1234" />
</h:button>

And in the target page I have:

<p>You may now log in with the account you just created: <b>#{param['acctName']}</b>.</p>
<p>This is account number <b>#{param['acctNo']}</b>.</p>

As before, the h:commandButton does not work with a POST transaction and as BalusC said, h:button does a GET and does work.

Interestingly enough, on the POST that the h:commandbutton does it has the parameters encoded, as viewed by Firebug:

acctName    This Is Account Name
acctNo  1234
javax.faces.ViewState   8642267042811824055:-4937858692781722161
testForm    testForm
testForm:j_idt55    testForm:j_idt55

So the f:param tags are doing their job at least, but the target page doesn’t resolve the EL expressions #{param[xxx]}. They also don’t show up in the scoped variables report (ctrl-shift-D). Is there something I am supposed to do on the target page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:11:51+00:00Added an answer on May 25, 2026 at 11:11 am

    This should work perfectly fine on JSF 2.x. Did you ever try it yourself? If it doesn’t work, then you’re either actually using JSF 1.x or you’re sending a redirect after POST.

    The other threads which you’re referring to were undoubtely talking about JSF 1.x, when the <f:param> was indeed not supported on <h:commandButton>. On JSF 1.x, you would have used <f:setPropertyActionListener> instead or some shot of CSS to style the <h:commandLink> to look like a button.

    E.g.

    <h:commandLink styleClass="button" ...>
    

    with

    a.button {
        display: inline-block;
        background: lightgray;
        border: 1px outset lightgray;
        outline: none;
        color: black;
        text-decoration: none;
        cursor: default;
    }
    a.button:active {
        border-style: inset;
    }
    

    Note that in JSF 2.x you’ve also the opportunity to use the new <h:button> which fires a GET request instead of a POST request. This is better if you don’t need to execute any bean action (i.e. your current action is just returning a plain navigation case outcome) and want the request to be idempotent.

    <h:button value="Create New Account" outcome="create">
        <f:param name="acctName" value="#{acctBean.handle}" />
        <f:param name="acctNo" value="#{acctBean.id}" />
    </h:button>
    

    This will navigate to create.xhtml with the given parameters in request URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read through the two other threads that extract the dll from the application
I've read through a few other threads on here, though none of them really
I've read through other questions but to no avail - I really can't work
I've read the other posts here about this topic, but I can't seems to
I have some data that is both read and updated by multiple threads. Both
I want to create a thread for some db writes that should not block
I know there are similar forum threads to this one, but I've read them
If you read other people's source code, how do you approach the code? What
I have read other related question but i cant really get them to relate
my jQuery.ajax return JSon object. I firstly read other articles. but their response text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.