Why not pre-decode the results in the action, populate a Collection, and add
a getDecoded method to the action which returns the pre-decoded Collection.
You can then use s:iterator to iterator over the collection and call methods
within each element. This allows you to implement whatever class hierarchy
you want for the objects in the collection to provide the data for your view
without needing a getXXXX method for each property.

Also as a side note, you said "...if the decoded value I'm searching is the
last in the list...", is there any reason you aren't taking your search
value, encoding it for your data model, and putting it into your database
query. That way you're using the database to do the search and you don't
pull all the data from a table over the network just to find one value.

-----Original Message-----
From: Paolo Beccari [mailto:[EMAIL PROTECTED] 
Sent: 06 June 2007 12:36
To: Struts Users Mailing List
Subject: Re: [S2] decoding values of objects properties


----- Original Message -----
From: "Dave Newton" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, June 06, 2007 1:14 PM
Subject: Re: [S2] decoding values of objects properties


> I'm still not entirely what you're decoding from and
> to; it sounds like something is fundamentally broken,
> but...
>

Ok, I explain: suppose we have an entity with a state property that can 
assume values 0, 1 where 0 stands for "Active" and 1 stands for "Not 
Active".
state is the property name
0 is the value
"Active" is the "decoded" value

It's often useful (at database level) to map certain properties to numbers 
(or strings, or whatever) which belongs to a description in metadata, so it 
is possible (for example) to change the description without any side-effects

on old stored data.

(Joining the table to retrieve the decoded value is not an option when the 
metadata table is shared through many sets of values and not dedicated to a 
precise field or table (it should be joined too many times): it is best 
effective to store metadata in memory and pick values from it.)

> Remember that with OGNL you *can* call arbitrary
> methods, including static utility methods, from with
> the EL. So with either a static decoding class or
> (preferably) a service object in your action if you're
> iterating over a list you can call methods on items
> from that list.
>
> d.

Ok, so it seems I'm missing some OGNL features: if I can call a method of an

Action that accept parameters in input then this is the solution. I'm going 
back to study and find how to.

Many thanks,
P.


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