Thank you Craig

now I have a form

TestBeanForm.java
public class TestBeanForm extends ActionForm {
   public ArrayList getTestBean() {
       if(testBean==null)
         testBean=new ArrayList();
       return testBean;
   }

   public void setTestBean(ArrayList testBean) {
       this.testBean = testBean;
   }

private ArrayList testBean;

}

and I write in the jsp this:
<html:form action="/testAction.do">
<logic:iterate name="testBean" id="mybean1" indexId="0">
<html:text name="testBean" property="" value="0" />
(QUESTION: I DONT KNOW WHAT TO SET TO THIS PROPERTY NOW, YET IT IS A MUST HAVE ATTRIBUTE)


  </logic:iterate>
  <html:submit property="submitValue">Submit Changes</html:submit>
</html:form>


and this is what I have in my configuration file


       <action path="/testAction"
           type="com.viador.rv.action.TestAction"
           name="TestBeanForm"
           scope="session">
       </action>

what should I do to submit values for my ArrayList type object testBean?


well, I suddenly found that testBean is not a bean, so those I have in the jsp file is meaningless, but then how can I submit values for an ArrayList object?


Thanks&Regards






From: "Craig Tataryn" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: RE: help me about indexed properties
Date: Thu, 11 Mar 2004 21:11:42 -0600 (CST)

Hi Mike, the attributes for logic iterate are all explained here:
http://jakarta.apache.org/struts/userGuide/struts-logic.html#iterate
and
http://jakarta.apache.org/struts/faqs/indexedprops.html

I've put it in my own words for you below:

For logic:iterate
==================
name attribute: tag looks in all three scopes
(page,request,application)for a bean with the name
equal to the value of this attribute. If it is found, and there is no
"property" attribute
specified elsewhere in the tag, then it will use the bean from the name
attribute as the List/Map to
iterate over.

property attribute: The property specified in the property attribute will
be applied against the
bean found in the name attribute and the value of this property will be
used as the List/Map to
iterate. So if you specify name="MyForm" and property="addresses" then
the list which will be
iterated over will be the value passed back from the interate tag
evaluating MyForm.getAddresses()

id attribute: for each loop of the iterate tag, place the next element
from the list into a
page-level bean named by the value of the id attribute.

idIndex attribute: for each loop of the iterate tag, place the current
index value of the element
from our List in the page-level int variable named by the value of the
idIndex attribute (value is
in [0..list.length])

For html:text
===============
The attributes are pretty well explained in
http://jakarta.apache.org/struts/userGuide/struts-html.html#text

Hope that's enough to get you started.

Craig
<tataryn:craig/>

On Fri, 12 Mar 2004 02:53:11 +0000, "Mu Mike" wrote:

>
> sorry, the last mail doesnt display correctly, but when I tried to
write a
> new one, I saw it displays correctly as the below
>
> Thanks&Regards
>
> >From: "Mu Mike" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: help me about  indexed properties
> >Date: Fri, 12 Mar 2004 02:49:47 +0000
> >
> >I have the below jsp file needs help
> >
> >
> >
> ><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> ><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> ><html>
> ><body>
> >  <html:form action="indexedtest5.do">
> >   <logic:iterate name="stringbean" property="stringArray" id="foo"
> >                  indexId="ctr">
> >    <!--what do name property id indexID mean here? what value can I
> >set to them?
> >     I searched online only fail to find any doc that give detailed
> >explaination about  these proeprties>
> >-->
> >    <html:text name="stringbean"
> >               property='<%= "labelValue[" + ctr + "].label" %>' />
> >    <!--what do name and propetry mean here? what value can I set to
> >them?-->
> >
> >   </logic:iterate>
> >   <html:submit property="submitValue">Submit Changes</html:submit>
> >  </html:form>
> ></body>
> ></html>
> >
> >and I dont have the related bean files ,can anyone give me example
> >bean files that can be used for this jsp file?
> >
> >Thanks&Regards
> >
> >_________________________________________________________________
> >与联机的朋友进行交流,请使用 MSN Messenger:
> >http://messenger.msn.com/cn
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _________________________________________________________________
> 享用世界上最大的电子邮件系统? MSN Hotmail。  http://www.hotmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

<tataryn:craig/>

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


_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn



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



Reply via email to