Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Struts1: Indexed Properties, BeanUtils populate, Form on REQUEST scope

Urso Wieske

2006-12-06

Replies:

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>



©2008 junlu.com - Jax Systems, LLC, U.S.A.