David Durham, Jr. wrote:
On Fri, Apr 4, 2008 at 1:39 PM, akash agrawal <[EMAIL PROTECTED]> wrote:
 It is a Boolean property but I still think it should work no matter whether it 
is boolean or Boolean. APIs I am using are not mine so I can't change the bean, 
but there are workaround I can put in although they aren't pretty. I was hoping 
something can be done on the framework (Struts2) side.

Ask not what the framework can do for you, but what you can do for the
framework ...   it's Friday.  Seriously though, if you need to provide
a getMyBoolean, and you can't modify the original class, you can just
provide a wrapper to translate getMyBoolean to isMyBoolean.  If it's a
public class as I think the JavaBean spec requires it to be, you can
just extend it, otherwise you need a delegator for not just this
property but all the others.  Anyway, it's not really clear that this
is what you need anyway, so this is just more speculation.

The JavaBean specification only talks about boolean properties; it doesn't mention Boolean (section 8.3.2). But rather than messing with an 'adapter' sub-class, I would consider either (a) creating a BeanInfo class or (b) simply living with it and just being explicit in OGNL expressions like so:

<s:checkbox name="xyz" label="xyzLabel" value="%{#myBean.isXyz()}" required="true" tooltip="xyzTooltip"/>

i.e. use method-call rather than simple property syntax.

L.


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

Reply via email to