You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pat Quinn <pa...@hotmail.com> on 2002/12/10 21:04:34 UTC

Form Bean with Lists & client updates

I have a form bean with an List(i.e. Lines) of Value Objects with the normal 
get/set method for the List only. Every thing works
fine when i display the data to the client. I have some thing like this:


---------
Form Bean
---------
public class myForm extends ActionForm {
	 private List lines = null;

    public List getLines() {
        return lines;
    }

    public void setLines(List lines){
        this.lines= lines;
    }
}

----------
JSP Source
----------
<logic:iterate name="myForm"  property="lines" id="line">
<tr>
<td><html:text name="line" property="firstName" size="10" 
maxlength="15"/></td>


My problem is trying to retrieve user changes when the form is submitted the 
variable firstName in my VO is null when it should contain the
users in put.

I guess i need to add extra methods to the form bean in order to populate my 
VO's correctly.... if so what format should they be??

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Form Bean with Lists & client updates

Posted by Justin Ashworth <ju...@ashworth.org>.
Hi Pat,

With the way you're using the <html:text> tag, you would need a getter and
setter for firstName if you're using a regular ActionForm. You might want to
try using a Map-backed (or List-backed) ActionForm to do your sets and gets.
Take a look at this - I think the examples make usage pretty clear:

http://jakarta.apache.org/struts/userGuide/building_controller.html#map_acti
on_form_classes

Justin

----- Original Message -----
From: "Pat Quinn" <pa...@hotmail.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, December 10, 2002 3:04 PM
Subject: Form Bean with Lists & client updates


> I have a form bean with an List(i.e. Lines) of Value Objects with the
normal
> get/set method for the List only. Every thing works
> fine when i display the data to the client. I have some thing like this:
>
>
> ---------
> Form Bean
> ---------
> public class myForm extends ActionForm {
> private List lines = null;
>
>     public List getLines() {
>         return lines;
>     }
>
>     public void setLines(List lines){
>         this.lines= lines;
>     }
> }
>
> ----------
> JSP Source
> ----------
> <logic:iterate name="myForm"  property="lines" id="line">
> <tr>
> <td><html:text name="line" property="firstName" size="10"
> maxlength="15"/></td>
>
>
> My problem is trying to retrieve user changes when the form is submitted
the
> variable firstName in my VO is null when it should contain the
> users in put.
>
> I guess i need to add extra methods to the form bean in order to populate
my
> VO's correctly.... if so what format should they be??
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>