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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:45:21+00:00 2026-06-15T13:45:21+00:00

In My .xhtml page I have 2 h:commandButton elements: <h:commandButton immediate=true lang=en class=msbutton action=#{user.changeLanguage()}

  • 0

In My .xhtml page I have 2 h:commandButton elements:

 <h:commandButton immediate="true" lang="en" class="msbutton"  action="#{user.changeLanguage()}" value="Test1">
 </h:commandButton>
 <h:commandButton immediate="true" lang="en" class="msbutton"  action="#{user.test()}"   value="Test2">
 </h:commandButton>

My problem Is when I refresh my page the last button that was clicked is triggred again, and the action in the managed bean is performed.

I don’t want the action to be triggred when the page is refreshed. (only to be triggred when the button is clicked).

Do I need to change something? what do i need to do inorder the page to be refreshed without triggreing the button action?

Thank’s In Advance.

  • 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-06-15T13:45:22+00:00Added an answer on June 15, 2026 at 1:45 pm

    This happens due to form re-submission. Add this line at the end of your methods.

    public void test() {
      .......
      FacesContext.getCurrentInstance().getExternalContext().redirect("current_page.jsf");
    }
    

    current_page is the name of your current page.

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

Sidebar

Related Questions

I have a <h:commandButton> in my XHTML page. I want the button to be
Consider a page webapp/myPage.xhtml : ... <h:form id=myForm> ... <h:selectOneMenu id=... required=true value=#{myController.aValue}> <f:selectItems
In my xhtml page I have the following tag included: <f:view locale=#{languageBean.locale}> ... </f:view>
I have a well formed XHTML page. I want to find the destination URL
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
I have the following markup inside a master page <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server>
I'm catching all exceptions within: java.lang.Throwable /page.xhtml java.lang.Error /page.xhtml But what If I get
I have three XHTML pages; index.xhtml page_1.xhtml page_2.xhtml In the index.xhtml page, I have
I have a very simple page that simply prompts the user for a name
I have a index.xhtml page listing books. Once a book is clicked it goes

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.