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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:31:36+00:00 2026-06-15T00:31:36+00:00

I have a backing bean method (session scoped) within two nested forms which will

  • 0

I have a backing bean method (session scoped) within two nested forms which will not fire.

I set out the question with a generic example which exhibits the problem.

I would appreciate an insight into how/why the forms, dialogs and appendToBody tag are causing the problem.

To clarify, the action in contentsOfDialogTwo.xhtml – nestedDialogsBean.actionOnClickOfDialogTwoItem() – does not fire. The javascript alert is displayed, but a breakpoint on the action on the backing bean shows that this is not called.

Template View:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<ui:composition>
    <ui:insert name="content"/>
</ui:composition>
</html>

Parent View:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<ui:composition template="../templates/layout.xhtml">
    <ui:define name="content">
        <h:form>
            <p:panel>
                <p:tabView id="exampleTabView" dynamic="false">
                    <p:tab id="nestedDialogsTab" title="Nested Dialogs Tab">
                        <ui:insert>
                            <ui:include src="childView.xhtml"></ui:include>
                        </ui:insert>
                    </p:tab>
               </p:tabView>
            </p:panel>
         </h:form>
    </ui:define>
</ui:composition>
</html>

Child view:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui">
    <ui:composition>
    <p:commandButton 
    id="openDialog1" 
    value="Open Dialog 1"
    action="#{nestedDialogsBean.actionOnOpenOfDialog1()}"
    oncomplete="dialogOneVar.show()">
     </p:commandButton>
    <p:dialog id="dialogOne" header="Panel One" widgetVar="dialogOneVar"
            resizable="false" modal="true" closable="true" dynamic="true"
            hideEffect="fold" draggable="false" height="700" width="1000">
            <ui:insert>
                <ui:include src="contentsOfDialogOne.xhtml"></ui:include>
            </ui:insert>
        </p:dialog>
    </ui:composition>
    </html>

contentsOfDialogOne.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
    <p:commandButton 
    id="openDialog2" 
    value="Open Dialog 2"
    action="#{nestedDialogsBean.actionOnOpenOfDialog2()}"
    oncomplete="dialogTwoVar.show()">
     </p:commandButton>
    <p:dialog id="dialogTwo"
        header="Dialog Two"
        widgetVar="dialogTwoVar" 
        closable="true"
        dynamic="true" 
            resizable="false" draggable="false" height="700"
        width="1000" hideEffect="fold" appendToBody="true" >
        <ui:insert>
            <ui:include src="contentsOfDialogTwo.xhtml"></ui:include>
        </ui:insert>
    </p:dialog>
</ui:composition>
</html>

contentsOfDialogTwo.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<ui:composition>
    <h:form id="innerWrapperFormForDialogTwoDueToAppendToBody">
         <p:commandButton id="actionInsideDialogTwouButton"
         action="#{nestedDialogsBean.actionOnClickOfDialogTwoItem()}"
                onclick="alert('Button clicked')"
                value="Invoke Backing Bean Action">
            </p:commandButton>
</h:form>
</ui:composition>
</html>
  • 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-15T00:31:38+00:00Added an answer on June 15, 2026 at 12:31 am

    Never use nested forms

    appendToBody : Appends dialog as a child of document body.

    When using it the rendered content of the dialog is being appended to the body , so if for example in your xhtml the dialog was wrapped by h:form and you using appendToBody="true" in the generated page the dialog wont be wrapped by the form tag


    This is illegal in HTML and the behaviour is unspecified and dependent on the webbrowser used. The ajax link doesn’t submit the form, it just collects the input values by JavaScript and then sends a XMLHttpRequest in the background.
    why a:commandLink’s action attribute works but h:commandLink’s does not?

    Multiple h:form in a JSF Page

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

Sidebar

Related Questions

I have two drop downs on a page whose backing bean is Request Scoped.
I have a java backing bean which has a method (call it getDataList() )
I have a problem with selectInputDate: I have a backing bean which I am
I have following two methods in my backing bean - public String validateUser() {
Background : I am having backing bean which has upload method that listen when
In a backing bean's @PostConstruct method, I make a call to an EJB which
I have Facelet component and I have backing bean for it. When I include
So, I have a backing bean, Foo, and a template with a client, request
I have a property in my backing bean that returns html code: public String
I have a backing bean, and I'd like to load up a few lists

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.