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.
This happens due to form re-submission. Add this line at the end of your methods.
current_pageis the name of your current page.