webtier@glassfish.java.net

Re: composite component with "for" attribute in jsf2.0 - is it possible?

From: <webtier_at_javadesktop.org>
Date: Wed, 31 Mar 2010 12:18:10 PDT

I have an idea, but it's kind of a hack, so hopefully someone has a better idea, but I'll give it to you anyway. Create an Event scoped bean, with a Map<String,FacesMessage[]> field, where you override the get() to do your bidding:

/*bean fluff*/

&nbsp;&nbsp;private Map<String,FacesMessage[]> facesMessageMap = new HashMap(){
&nbsp;&nbsp;&nbsp;&nbsp;@Override
&nbsp;&nbsp;&nbsp;&nbsp;public FacesMessage[] get(Object _key){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String key = _key.toString();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FacesContext.getCurrentContext().getMessageList(key);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
  
&nbsp;&nbsp;public Map<String,FacesMessage[]> getFacesMessageMap(){return facesMessageMap;}

/*more bean fluff*/

Then, in your EL, you specify #{bean.facesMessageMap[cc.attrs.for]}


Give this a try. Did this off the top of my head, so you may have some errors you need to work through, but the idea is there.

-ds
[Message sent by forum member 'digitalseraphim']

http://forums.java.net/jive/thread.jspa?messageID=394717