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 7088593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:49:11+00:00 2026-05-28T07:49:11+00:00

I have a button to submit a form and invoke a managed bean action.

  • 0

I have a button to submit a form and invoke a managed bean action.

<h:form>
    ...
    <h:commandButton value="Submit" action="#{bean.submit}" />
</h:form>

But when I press the button it refreshes the whole page and sometimes also changes the URL.

Is there some way to not refresh the page and still invoke the action?

  • 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-28T07:49:12+00:00Added an answer on May 28, 2026 at 7:49 am

    Make use of Ajax. It’s a matter of nesting <f:ajax> inside the command button of interest.

    <h:form>
        ...
        <h:commandButton ...>
            <f:ajax execute="@form" render="@none" />
        </h:commandButton>
    </h:form>
    

    Particularly the render="@none" (which is the default value anyway, you could just omit the attribute altogether) will instruct JSF to re-render just nothing after the submit. If you intend to re-render only a specific component instead of the whole page, then you could also specify the ID of that specific component in render attribute.

    <h:form>
        ...
        <h:commandButton ...>
            <f:ajax execute="@form" render="result" />
        </h:commandButton>
        ...
        <h:panelGroup id="result">...</h:panelGroup>
    </h:form>
    

    If you’re already using PrimeFaces, then it’s a matter of simply using <p:commandButton> instead of <h:commandButton>. It uses by default ajax already, so you don’t need to nest in a <f:ajax>. You only need to remember to use attribute names process and update instead of execute and render.

    <h:form>
        ...
        <p:commandButton ... update="result" />
        ...
        <h:panelGroup id="result">...</h:panelGroup>
    </h:form>
    

    The execute attribute defaults to @form already, so it could be omitted.

    See also:

    • Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes
    • How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"
    • Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in an HTM page that, after pressing the submit button,
I have a form with an input element but no submit button. I use
I have Jquery Form plugin but i do not have submit button in my
I have a image button thats acts as a form submit button: <a href=#
I have... a dynamic populated select box several input boxes a submit button form
I have a form with a submit button. I have called a function on
I have a form with a css submit button. When a the submit button
I have a listbox on an HTML form with a Submit button. The listbox
I have a checkbox with id terms and a submit button in my form
I have a form, and want to disable/enable its submit button depending on whether

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.