[jsr-314-open] required attributes in composite components

Pete Muir pmuir at REDHAT.COM
Fri Apr 3 08:50:50 EDT 2009


Yes, I like the idea. I was trying to think about attribute names, as  
restrictAttributes feels wrong. How about

* strict="{true|false}"
* complete="{true|false}"

On 2 Apr 2009, at 12:56, Kito Mann wrote:

> So, here's one other thing that came up at JSFDays -- the fact that  
> composite components (like Facelet compositions) don't restrict  
> which attributes can be used. This is fine for Facelet compositions,  
> but since composite components can define specific attributes, it  
> makes sense to give component authors the ability to restrict page  
> authors to those attributes.
>
> I think the easiest way to handle this from a component author's  
> perspective would be to add an attribute to the  
> <component:interface> tag:
>
> <component:interface restrictAttributes="true">
>   <component:attribute name="name" required="true"/>
>   <component:attribute name="size"/>
> </component:interface>
>
> So, in this case, this component would _only_ accept the name and  
> size attributes, and the runtime would throw an exception if another  
> attribute were used. An IDE could also complain when someone tried  
> to use a different attribute.
>
> Thoughts?
> ---
> Kito D. Mann -- Author, JavaServer Faces in Action
> http://twitter.com/kito99  http://twitter.com/jsfcentral
> http://www.virtua.com - JSF/Java EE consulting, training, and  
> mentoring
> http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
> +1 203-404-4848 x3
>
> Public JSF Course in NYC (April 21st-24th): http://www.regonline.com/jsf-course
>

--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete




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