what does you form bean look like (dyna or otherwise)?




On 13 Jan 2004, at 12:07, shankarr wrote:

Hi!
I was myself trying to work on a similar issue.

My problem is as follows:
i query db.
Then store data in Araylist.
How to pass this to jsp page?

Any sample code great appreciation.
Please urgent.

Sha

At 02:27 PM 1/12/2004 -0700, you wrote:
> From: Wendy Smoak
> Apparently you don't have to use
> logic-el:iterate with html-el:checkbox & indexed="true". This works:
> <c:forEach items="${accountMap[accountForm.map.calendarYear]}"
> var="account" >
> <html-el:checkbox property="accounts" indexed="true">


I lied, that doesn't work at all. It produces HTML like this:

  <input type="checkbox"
name="org.apache.struts.taglib.html.BEAN[0].accounts"
value="on">10_U_FADA0001

I read that indexed properties only work with logic:iterate, so I'm
trying to change over from logic:forEach. Can someone help me sort this
out?


This works to generate HTML, but BeanUtils can't populate the ArrayList
that is the 'accounts' property of accountForm because the bracketed []
indexes are missing.


<logic-el:iterate
collection="${accountMap[accountForm.map.calendarYear]}"
                  id="acct"
                  indexId="ctr">
     <html-el:checkbox property="accounts" >
        <c:out value="${acct.key}"/>
     </html-el:checkbox>
     ...

However, if I add indexed="true" like so:

<logic-el:iterate
collection="${accountMap[accountForm.map.calendarYear]}" id="acct"
indexId="ctr">
     <html-el:checkbox property="accounts" indexed="true">
        <c:out value="${acct.key}"/>
     </html-el:checkbox>

It renders this HTML:
     <input type="checkbox"
name="org.apache.struts.taglib.html.BEAN[0].accounts"
value="on">10_U_FADA0001

??! This is my first attempt at indexed properties, which apparently I
need in order to use an ArrayList. (The items in the ArrayList are just
Strings, not complex objects. This isn't nested properties, it's just a
bunch of checkboxes. I'm trying to use ArrayList instead of String[] to
avoid out of bounds errors. String[] was working *fine* last week,
until I got the bright idea to use ArrayList.)


I'm getting the feeling that the things in the ArrayList property of the
form have to be complex objects and not just Strings.


--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management

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

"To achieve all that is possible, one must attempt the impossible"




---------------------------------------------------------------------
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