[jboss-user] [JBoss Seam] - Re: Problem with injection in an jsf action listener

petemuir do-not-reply at jboss.com
Mon Oct 2 13:50:10 EDT 2006


"cristi.ciuc" wrote : Thank you for the replies.
  | 
  | So, I understand that when 
  | 
  | <f:actionListener type="com.nortel.emp.listener.AddRoleListener" />
  | 
  | is called, a new instance of the listener gets created, that is not intercepted by Seam. Is that correct?

Yes, from org.apache.myfaces.taglib.core.ActionListener

ActionListener al = (ActionListener)ClassUtils.newInstance(className);

and ClassUtils.newInstance is basically a wrapper for Class clazz.newInstance();

anonymous wrote : If so,  my question still stands: how can I use seam injection in a JSF ActionListener? How can I tell Seam via the <f:actionListener /> tag to use an existing instance of my listener, (annotated as a seam component ) and not create a new one?
  | 

Well AFAICS you can't with f:actionListener as it stands - you have to use the actionListener attribute on the tag.

You could of course extend/create your own my:actionListener with, say, a value attribute, which would would then instantiate a Seam component (either via EL using the SeamVariableResolver or as Gavin mentioned above).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975574#3975574

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975574



More information about the jboss-user mailing list