So what BeanUtils exception are you getting?

Your jsp should be generating the following?
   <input type=".." name="someWrapper[0].propA" ...>
   <input type=".." name="someWrapper[1].propA" ...>

BeanUtils will try and access the indexed getter - getSomeWrapper(0)
and then call setPropA(...) - presumably its one of these methods ist
having problems with?

Anyway the problem usually with request scope beans is that when it
calls the getSomeWrapper(index) method the array isn't initialized and
it returns null - if you put logic to "automatically" grow your array
in the getSomeWrapper(index) method then it should solve this.

Niall

On 12/6/06, Urso Wieske <[EMAIL PROTECTED]> wrote:
Hi folks,

I have problem with the scenario "Indexed Properties, BeanUtils and Form on REQUEST 
scope".
When I select a a value from (1 or 2) from the dropdownlist and submit the 
form, I get an exception from BeanUtils.populate method about some getter which 
can be found!??
IF change the scope of myForm to Session in my struts configuration, then I 
don't have a problem with beanutils. But I want my form on request scope!

I have described below my problem scenario.

Is there a solution to this problem?? (form on request scope)
I have looked in diffenrent aspects but I am not sure what is happening here 
with BeanUtils:
- commons BeanUtil JAR version issue?
- scope (request/session) issue?
- JRE/Beanutil issue?
- program issue of in my scenario?
- array issue?


Thanks
Urso Wieske


Scenario abstraction of my problem:
1.PrepareAction/myForm --------{forward}--------> 2.viewJSP 
-----{submit}-------> 3.ProcessAction/myForm


Action Mapping Configuration relevant settings:
1) myForm (MyForm class) is on request scope
3) myForm(MyForm class)  is on request scope


MyForm considerations:
I have a property "someWrappers" of type array of SomeWrapper (thus, not a List 
type!)
properties:
- SomeWrapper [] getSomeWrappers() { return someWrappers;}
- void getSomeWrappers(SomeWrapper [] someWrapper) {this.someWrappers = 
someWrapper;}
- SomeWrapper getSomeWrapper(int index) {return someWrappers[index];}
- void setSomeWrapper(int index, SomeWrapper someWrapper) 
{this.someWrappers[index] = someWrapper;}

I have changed the name of the indexed property from plural to single noun 
(someWrapper,... to bypass the JRE1.3/1.4 - JavaBeans specs - BeanUtils issue.
My Target runtime is JRE5.

viewJSP is a JSP file which has the following structure:

<html:form action="/someAction">
.....
        <logic:notEmpty name="myForm" property="someWrappers" >
                <logic:iterate property="someWrappers" id="someWrapper" >
                        <html:select name="someWrapper" property="propA" 
indexed="true">
                                <html:option value="1">1</html:option>
                                <html:option value="2">2</html:option>
                        </html:select>
                <logic:iterate>
        </logic:notEmpty>

.....
</html:form>






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

Reply via email to