struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: [s2] Question about Advanced Type Conversion/Collection and Map Support
Date Tue, 11 Mar 2008 13:31:10 GMT
Nandana Mihindukulasooriya wrote:
> Hi,
>    I want to use type conversion  feature to convert set of values to
> a list in my action as mentioned in the type conversion documentation
> (Advanced Type Conversion/Collection and Map Support) [1]. I followed
> the steps but still no luck. I have few questions. (please excuse if
> these questions are too naive , I am new to Structs 2).
>
> i)   Where should I put MyBeanAction-conversion.properties file ?
>   

In the same directory as MyBeanAction.java

> ii)  Using the debug mode, can I check whether the
> ObjectTypeDeterminer picked it ?
>   

Yes, download the source code for Struts and XWork and you can trace 
through it.  I don't recall it displaying any useful debug messages in 
the log.

I find this type "advanced" conversion very frustrating every time I 
attempt to use it.  Just try to keep it simple.
I always either use:
  a Map, and reference each entry by its key (which is a string).  eg 
field['a'].value; or
  a List, and reference each try by its index eg. field[0].value; and
  make each entry a simple bean that doesn't require non-standard conversion
 
Finally ensure you have getters for the collections so OGNL can get it 
before writing to it, and ensure it's a non-abstract type or instantiate 
it yourself before the entries are set on it.

Also turn on devMode for your application.

Hope that helps.

Examples: http://www.planetstruts.org/struts2-showcase/conversion/index.jsp

>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message