[jsr-314-open] EL property accessor name Forgiveness / Flexibility

Pete Muir pmuir at redhat.com
Wed Jul 22 07:07:33 EDT 2009


I'm with Lincoln here - sounds like an obvious, easy, improvement can  
be made to EL here...

On 21 Jul 2009, at 23:12, Lincoln Baxter, III wrote:

> I just ran across this when using the Builder pattern in some Pojos  
> -- each setter returns the current instance of the pojo to allow for  
> chaining set-statements:
>
> Pojo pojo = pojo.setName("name").setValue(23);
>
> With setters implemented like so:
>
>     public Project setName(final String name)
>     {
>         this.name = name;
>         return this;
>     }
>
> But JSF complains:
> javax.servlet.ServletException: javax.el.PropertyNotFoundException: / 
> faces/page.xhtml @36,20 value="#{pageBean.pojo.name}": Property  
> 'name' not writable on type java.lang.String
>
> It seems to me that this is a slightly harsh restriction. Is there  
> anything we can/should do about this? Does anyone else feel it's  
> worth mentioning?
>
> The obvious answer is to use dumb getter/setter methods, but in some  
> cases that can be restrictive, and I like the idea of being more  
> forgiving.
>
> Thoughts?
>
> --Lincoln





More information about the jsr-314-open-mirror mailing list