struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnson, Gary" <>
Subject Nested Indexed Property Question
Date Thu, 19 Feb 2004 03:36:22 GMT
Hello *,
    I've been trying to generate a variable list of text fields with each
row containing a radio button and 2 text fields. The getters seem to work
OK, but can't seem to make the setters work. I've read the FAQ, searched the
mailing lists, and scoured the web looking for clues as to why the page data
isn't being set in my form class from the request object. Any help would be
greatly appreciated.....TIA, Gary

This JSP snippet

<logic:iterate id="agencyInfo"
        <td><html:radio name="agencyInfo" property="optionSelected"
idName="agencyInfo" value="agencyId"/></td>
        <td><html:text  name="agencyInfo" property="fileDirectory"
        <td><html:text  name="agencyInfo" property="pollingInterval"

Generates this HTML

    <td><input type="radio" name="optionSelected" value="1"></td>

    <td><input type="text"  name="agencyInfo[0].fileDirectory"   value="File
Directory 0"></td>
    <td><input type="text"  name="agencyInfo[0].pollingInterval"

    <td><input type="radio" name="optionSelected" value="3"></td>

    <td><input type="text"  name="agencyInfo[1].fileDirectory"   value="File
Directory 1"></td>
    <td><input type="text"  name="agencyInfo[1].pollingInterval"

Which I believe is correct. The getAgencyFileInfo method is returning an
ArrayList of AdminAgencyFileSetupForm objects and struts is correctly
retrieving fileDirectory and pollingInterval values. If I'm reading the
Indexed property FAQ correctly struts should call getAgencyInfo(int index)
to first retrieve the correct AdminAgencyFileSetupForm object and then call
setFileDirectory("page_field_data") and

After changing 1 set of fields on the page the log shows:

, agencyInfo[1].pollingInterval, [1567])
2004-02-18 21:33:53,088  - >>>>> Entering getAgencyInfo(1)
2004-02-18 21:33:53,088  -     Target bean = 
	optionSelected = 'null'
	action         = 'null'
	saveBtn        = 'null'
	agencyId       = '3'
	fileDir        = 'File Directory 1'
	pollIntvl	   = '1'

2004-02-18 21:33:53,088  -     Target name = pollingInterval
2004-02-18 21:33:53,088  - Skipping read-only property
2004-02-18 21:33:53,088  -   setProperty(
	optionSelected = 'null'
	action         = 'null'
	saveBtn        = 'null'
	agencyId       = 'null'
	fileDir        = 'null'
	pollIntvl	   = 'null'

So, getAgencyInfo(index) is being called, but struts can't seem to find the
setPollingInterval(String) method (and it is defined), assumes it is
read-only and skips. I've tried every permutation for defining the iterate
and text options and methods and nothing seems to work. Would a more
experienced struts developer be so kind as to let me know what the heck
might be wrong here?......Again, TIA, Gary

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message