Hello all,

 

I’m a little stuck & need some guidance.

 

I have a web page with 2 forms on it. (Bean01 & Bean02).

I want to be able to have the user click a button and then behind the scenes take the data from these 2 beans and persist it.

I’m not sure how to do this & require someone pointing me in right direction.

 

Example of what I’m trying… (I know this wont work, I’d like to know what I should do)

 

<h:form>

 

<h:form id="form1" name="formBean01">

      <h:inputText id="name01" value="01" maxlength="10" size="15" required="true" />

      </h:form>

 

      <h:form id="form2" name="formBean02">

      <h:inputText id="name02" value="02" maxlength="10" size="15" required="true" />

      </h:form>

 

                 

      <h:commandButton value="Create" action="#{taskMangerBean.saveBeans}"/>

</h:form>

 

 

   public String saveBeans() {

        FacesContext facesContext = FacesContext.getCurrentInstance();

        VariableResolver vr = facesContext.getApplication().getVariableResolver();

       

        Bean01 bean01 = (Bean01) vr.resolveVariable(facesContext, "bean01");

        Bean02 bean02 = (Bean02) vr.resolveVariable(facesContext, "bean02");

       

        //insert any bus logic here

        return ("sucesss");

    }

 

 

 

Thanks

Jeff

Reply via email to