> But in the EL, you still use the *property name* not the accessor
method.

That's not completely true, is it?  We have getAbc() and isXyz() methods
that have no corresponding property in the class, and we reference them
fine using #{myBean.abc} and #{myBean.xyz} notation.  So, as far as I
can see, JSF just mechanically translates myBean.abc to myBean.getAbc()
or myBean.isAbc(), depending upon the context.

By the way, do you have a link for the Java spec that lists the bean
property naming rules.  I hunted around, but I couldn't locate the exact
spec.

Thanks,

- Brendan

-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 21, 2005 11:58 PM
To: MyFaces Discussion
Subject: Re: IF statement..?


Jeffrey Porter wrote:
> It would be nice to add in more control, just like in JSP's.
> 
> e.g. <%if (myObject.getName().equalsIgnoreCase("BOB"))
{/**something**/}

Having code in your presentation page is a *very bad idea* for large 
projects with long lifetimes. That's why JSP is such garbage for large 
projects, and why something like Facelets is so much better; JSP tempts 
people to put code like the above in pages instead of putting that code 
where it belongs.

For small projects or temporary projects it *can* be convenient to put 
logic in the page - but IMHO those sorts of projects are probably better

off being built in PHP or Ruby-on-rails than a heavyweight setup such as

java/jsf/ejb.


Re the original issue of bean properties with unusual names (isXYZ): the

java spec is very clear about what is a bean property and what its 
accessor methods should be called: if the property is XYZ then the 
accessors are "getXYZ(), setXYZ(val)". But EL uses *property names* not 
method names. There is a way to customise this though; write a BeanInfo 
class:
   http://java.sun.com/j2se/1.4.2/docs/api/java/beans/BeanInfo.html
You can then call your properties whatever you want, and specify what 
methods are the accessors for that property. But in the EL, you still 
use the *property name* not the accessor method.

Regards,

Simon

Reply via email to