0

I'm passing a bean (it's a subbean because it's contained in another Session bean), this bean should be passed from client template-1 to another client template-2, but the received value is null. However I can properly send parameters using ui:param between pages but the bean could not be send between client templates. Note that the client template2 will override client template 1, and it goes in the content area of the main menu (maintracking.xhtml).

QUESTION: how to send a beans/share backend data between client templates?

Platforms: netbeans: 8.0 Jsf 2.2, primeface 4.0 Apache Tomcat 7

bean null screenshot http://safirasoft.com/wp-content/uploads/2014/04/beannull.png

public class SubBean implements Serializable{
//---  
}

@ManagedBean
@SessionScoped
public class FicheDescControl implements Serializable 
 {
   Subbean subbean;
//....
}

main menu (template): maintracking.xhtml

<h:body>
    <div id="top" class="top">
        <ui:insert name="top"> 
             top content
            </ui:insert>
    </div>

    <div id="content" class="center_content">
        <ui:insert name="content"></ui:insert>
    </div>

</h:body>

Client 1 template:

<ui:composition template="./maintracking.xhtml">
        <ui:define name="content">
            <h:form>              
                <p:dataTable  id="table" value="#{ficheDescControl.lfiches}" var="fiche" >

                        <h:commandButton action="#{ficheDescControl.retrieveFiche()}" value="Donner le Visa (Accord)"  rendered="#{p:ifGranted('chef')}">
                            <f:setPropertyActionListener target="#{ficheDescControl.idFicheParam}" value="#{fiche.idFicheDescriptive}" />
                        </h:commandButton>
                    </p:column>   
                    <ui:param name="idFicheParamP" value="behhhh" />
                </p:dataTable>
            </h:form>
        </ui:define>
    </ui:composition>

Client2 template:

<ui:composition template="./maintracking.xhtml">
        <ui:define name="content">    
                    <f:view>
                        <p:outputLabel style="color: red;font-size: medium;      font-weight: bolder;"
                                       value="idFicheParam =  #{ficheDescControl.idFicheParam}"/>  
                        <p:outputLabel style="color: red;font-size: medium; font-weight: bolder;" 
                                       value="  ----- selected subbean: #{ficheDescControl.subbean}"/>  



                            <h:commandButton action="#{ficheDescControl.edit()}" value="Valider" />
                        </h:form>
                    </f:view>
        </ui:define>
    </ui:composition>
Salim R
  • 343
  • 7
  • 16
  • SessionScoped beans exists in life time of user session. So you don't have to send beans between pages, each page can access them. Anyway as far as I know, there is no such thing as "subbean". – klimpond Apr 03 '14 at 08:56
  • thank you, I know that I have something wrong in my code, however I omitted embedding the Edit Form in a template, I opened this form in a NEW page. It seems that an object included in a Session Bean may not be available for all page in my case. – Salim R Apr 04 '14 at 10:05
  • I would recommend some debugging and logging when your bean is initialized (constructor or `@PostInit` methods) and to your setters and getters, when accessed from xhtml. Then you can find out what is going wrong. – klimpond Apr 04 '14 at 10:11

0 Answers0