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

  • Home
  • SEARCH
  • 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 9229323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:32:34+00:00 2026-06-18T05:32:34+00:00

I have a though issue with JSF 2. I use Mojarra 2.1.14 with Primefaces

  • 0

I have a though issue with JSF 2. I use Mojarra 2.1.14 with Primefaces 3.1.4

I have a page with 2 forms : formA and formB. The two forms contains each the ViewState in an hidden input field.

<h:form id="formA" binding="#{sessionBean.formA}">
    <h:commandButton value="formA" action="#{sessionBean.actionA}">
        <f:ajax/>
    </h:commandButton>
</h:form>

<h:form id="formB" binding="#{sessionBean.formB}">
    <h:commandButton value="formB" action="#{sessionBean.actionB}">
        <f:ajax/>
    </h:commandButton>
</h:form>

User submits formA with an Ajax action. Inside the Java action I update explicitly formA and formB (which are binded).

public void actionA(){
    FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(formA.getClientId());
    FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(formB.getClientId());
    System.out.println("action A!!");
}

public void actionB(){
    System.out.println("action B!!");
}

In the Ajax responses there is the HTML code for formA and formB ( element) and the ViewState.

JSF updates the HTML of formA and formB and set the ViewState of the calling form : formA. formB do not contains any ViewState.

User submit formB with an Ajax action. Because ViewState is not defined, postBack is false and the renderResponse is set to true in the RESTORE phase, skipping the INVOKE APPLICATION phase: the action is not called. After the response VIEW_STATE is updated and if user sumbit formB, the action is called.

Is it a JSF 2 bug or limitation? Or Do I do something wrong ?

You can find a maven projet on GitHub:
https://github.com/nithril/jsf-multiple-form

Thanks in advance for your help!

  • 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-18T05:32:36+00:00Added an answer on June 18, 2026 at 5:32 am

    Problem you are facing is connected with known issue with JSF JavaScript library. Workaround is to explicitly set client id of another form in rendered attribute of f:ajax tag:

    <h:form id="formA" binding="#{sessionBean.formA}">
      <h:commandButton value="formA" action="#{sessionBean.actionA}">
        <f:ajax render=":formB @form"/>
      </h:commandButton>
    </h:form>
    
    <h:form id="formB" binding="#{sessionBean.formB}">
      <h:commandButton value="formB" action="#{sessionBean.actionB}">
        <f:ajax render=":formA @form"/>
      </h:commandButton>
    </h:form>
    

    More about this:

    • Ajax rendering of content which contains another form
    • javax.faces.ViewState is missing after ajax render
    • Rendering other form by ajax causes its view state to be lost, how do I add this back?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, I am sorting an XMLListCollection in alphabetical order. I have one issue though.
I have a selectInputText in my jsf <ice:panelPopup page which gets invoked upon clicking
I have a JSFiddle though I seem to be having an issue with it.
I have a query that runs multiple times a day, the issue though is
I have an issue that keeps arising with JSF 2 and Tomcat 7.0.0. When
I have gone through many posts on SO regarding this issue: Tried everything in
I have been through numerous similar questions on this forum but my issue still
I have seen many posting this issue in SO. I have gone through those
I have been having this issue in iterating through an array of keys and
I have this issue, I'm have a user selected in LDAP through ldap search,

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.