Sridhar,

See the thread from 7/28-7/30 titled inxeded properties.  Everything you
need is in that thread.  The basic problem here is that your Form class
properties and your jsp names need to line up properly.  The thread I
mentioned should help you out.

Nick



                                                                                       
                                                
                      Paul Thomas                                                      
                                                
                      <[EMAIL PROTECTED]        To:       struts-user <[EMAIL 
PROTECTED]>                                  
                      co.uk>                   cc:                                     
                                                
                                               Subject:  Re: struts problem(Unable to 
populate the form in the jsp to ActionForm bean) 
                      08/08/2003 06:19                                                 
                                                
                      AM                                                               
                                                
                      Please respond to                                                
                                                
                      "Struts Users                                                    
                                                
                      Mailing List"                                                    
                                                
                                                                                       
                                                
                                                                                       
                                                





On 08/08/2003 02:11 Sridhar Kotagiri wrote:
> Hi,
>    I have a Action form which contains an arraylist the array list adds
> beans which are called IpAddress(two String properties).I am able to
> display in the jsp page but when I submit this form it is unable to
> populate to the action form.
>
>
>
>
>                        <b class="txtMedium" id="large"><bean:message
> bundle="content" key="title.ipaddresses"/></b>
>                        <table width="100%" cellspacing="0" cellpadding
="2"
> border="0">
>                                    <logic:iterate id="Element" name
="editAdvancedForm"
> property="alist">
>                                                <tr class="textbox"
> style="width:150px;">

>                                                            <td><html:text
name="Element"
> property="domainName"
> /></td>
>
<td><b><bean:message
> bundle="content"
> key="common.pointsto"/></b></td>
>                                                            <td><html:text
name="Element"
> property="ipValue"
> /></td>

>                                                </tr>
>                                    </logic:iterate>
>                        </table>
>
>
>
>
>
>
> public class EditAdvancedForm extends ValidatorForm {
>     //~ Instance fields
> --------------------------------------------------------
>
>            private String domain_Id;
>            private ArrayList alist;
>            private IpAddress ip1;
>
>            public EditAdvancedForm(){
>                        alist=new ArrayList();
>                        ip1=new IpAddress();
>
>            }
>
>            public void setDomainName(String name)
>            {
>                        ip1.setDomainName(name);
>            }
>            public String getDomainName()
>            {
>                        return ip1.getDomainName();
>            }
>            public void setIpValue(String name)
>            {
>                        ip1.setIpValue(name);
>                        alist.add(new
> IpAddress(ip1.getDomainName(),ip1.getIpValue()));
>            }
>            public String getIpValue()
>            {
>                        return ip1.getIpValue();
>            }
>
>            /**
>             * @return
>             */
>            public String getDomain_Id() {
>                        return domain_Id;
>            }
>            /**
>             * @return
>             */
>            public IpAddress getIp1() {
>                        return ip1;
>            }
>
>            /**
>             * @param address
>             */
>            public void setIp1(IpAddress address) {
>                        ip1 = address;
>            }
>
>            /**
>             * @return
>             */
>            public ArrayList getAlist() {
>                        return alist;
>            }
>
>            /**
>             * @param list
>             */
>            public void setAlist(ArrayList list) {
>                        alist = list;
>            }
>
> }
>
>
>
> public class IpAddress {
>            private String domainName;
>            private String ipValue;
>            private String flag;
>            private String flag1;
>
>            public IpAddress(String str1,String str2)
>            {
>                        this.setDomainName(str1);
>                        this.setIpValue(str2);
>            }
>            public IpAddress(){
>            }
>            /**
>             * @return
>             */
>            public String getDomainName() {
>                        return domainName;
>            }
>
>            /**
>             * @return
>             */
>            public String getIpValue() {
>                        return ipValue;
>            }
>
>            /**
>             * @param string
>             */
>            public void setDomainName(String string) {
>                        domainName = string;
>            }
>
>            /**
>             * @param string
>             */
>            public void setIpValue(String string) {
>                        ipValue = string;
>            }
>
>
>
> }
>
>
>

Your form bean should have an indexed property (see the Struts docs) of
type IpAddress. Say you call this ipAddress, then your logic;iterate tag
shoudol have id="ipAddress" and  your html:text tag should have
name="ipAddress" indexed="true".

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+

| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to