Thanks for the prompt reply Jan.

 

So I should have the following in the JSP file…

 

<h:form>
 
      <h:inputText id="name01" value="01" maxlength="10" size="15" required="true" />
 
      <h:inputText id="name02" value="02" maxlength="10" size="15" required="true" />
 
      <h:commandButton value="Create" action="#{taskMangerBean.saveBeans}"/>
</h:form>

 

I’ve done this, but when the even is called the 2 beans contain null values.

 

How does MyFaces/JSF know that name01 belongs to the bean Bean01 & that name02 belongs to the bean Bean02?

 

Thanks

Jeff.

 

 

 

 

-----Original Message-----
From: ir. ing. Jan Dockx [mailto:[EMAIL PROTECTED]
Sent: 12 October 2005 16:55
To: MyFaces Discussion
Subject: Re: one button 2 forms... how?

 

You can't nest forms. Just remove the nested form definitions. You're done.

On 12 Oct 2005, at 17:42, Jeffrey Porter wrote:

 
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

Met vriendelijke groeten,

Jan Dockx

PeopleWare NV - Head Office
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66

PeopleWare NV - Branch Office Geel
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25

http://www.peopleware.be/
http://www.mobileware.be/

Reply via email to