You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pierre Lavignotte <pi...@gmail.com> on 2009/04/17 15:38:42 UTC

Re: Is there a way to make Struts2 working with other methods different than classic getter/setter?

Hi,

Not sure to understand but I think you don't have any problem...

If you use a tag like <s:property value="bankingCodePrecedeedByAnyZero"/>
Struts will not look to the attribute bankingCodePrecedeedByAnyZero but for
the method getBankingCodePrecedeedByAnyZero().

You can even write this method without having the
bankingCodePrecedeedByAnyZero attribute at all, or name it myBankingCode, or
superMan or anything you want.


Hope it helps,
Pierre

Cordialement,
Pierre Lavignotte
Ingénieur Conception & Développement
http://pierre.lavignotte.googlepages.com


On Fri, Apr 17, 2009 at 3:31 PM, Federica Oltolina <
federica.oltolina@ubiquity.it> wrote:

> Hi all,
> my head office yesterday asked me if it's possible to declare
> in some special file a mapping between actions and their methods
> because he'd like to use custom getter/setter methods containing some
> little formatting operations.
>
> For example, for the action attribute:
> /
> private String bankingCode;/
>
> he liked having in our action more than one getter that would sound like:
>
> /getBankingCodePrecedeedByAnyZero();
> getBankingCodePrecedeedByFiveZero();
> and so on...
>
> /and then in the jsp that corresponds to the action cited above ho would
> Struts2 to be able
> to understanding the correct setter/getter method, for example he'd like to
> write
>
> /...
> <s:property value="//bankingCodePrecedeedByAnyZero//"/>
> ...//
> /
> obtaining the result of the method /getBankingCodePrecedeedByAnyZero();
>
> /Someone knows if there is a way to do this?
> No matter if this sounds like a swearword for a Struts2 good user
> or if this is not smart, he asked me this.
>
> Thanks in advance
> Federica
>
>