I think I just stumbled on the answer while slogging through the code,
You have to call:

Dispatcher.getInstance().getContainer().inject(this);

somewhere early on.  I'm putting it in doStartTag (Where the
ComponentTagSupport class has it) and I'm testing now.
  (*Chris*)

On 9/18/07, Ian Roughley <[EMAIL PROTECTED]> wrote:
> I'm not sure that tag libraries are created by the object factory, if
> this is the case, then the behaviour you are observing is correct (as
> the annotations aren't checked and thus values not injected).  You
> should be able to track back the object creation in the code to confirm
> this.
>
> /Ian
>
> Chris Pratt wrote:
> > I'm attempting to understand the @Inject Annotation and how it can be
> > used.  I'm trying to create a tag library that needs to look up action
> > data, so following the pattern from the FormTag I added this methods
> > to my tag class:
> >
> >   private boolean enableDynamicMethodInvocation = true;
> >   private Configuration configuration;
> >   private ActionMapper actionMapper;
> >
> >   /**
> >    * Inject a flag as to whether Dynamic Method Invocation is enabled
> >    *
> >    * @param enable "true" to enable
> >    */
> >   @Inject(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)
> >   public void setEnableDynamicMethodInvocation (String enable) {
> >     enableDynamicMethodInvocation = Boolean.parseBoolean(enable);
> >     log.debug("Dynamic Method Invocation Enabled {}",enable);
> >   } //setEnableDynamicMethodInvocation
> >
> >   /**
> >    * Inject the Struts Configuration for looking up the proper Action
> >    *
> >    * @param config The Struts Configuration
> >    */
> >   @Inject
> >   public void setConfiguration (Configuration configuration) {
> >     this.configuration = configuration;
> >     log.debug("Struts Configuration {}",configuration);
> >   } //setConfiguration
> >
> >   /**
> >    * Inject the Action Mapper
> >    *
> >    * @param actionMapper The Action Mapper
> >    */
> >   @Inject
> >   public void setActionMapper (ActionMapper actionMapper) {
> >     this.actionMapper = actionMapper;
> >     log.debug("Struts Action Mapper {}",actionMapper);
> >   } //setActionMapper
> >
> > But the attributes never get injected into the class.  Is there
> > something else that I have to configure to get this working?  Thanks.
> >   (*Chris*)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to