You should be seeing some logged console messages about private variables.
Only private instance variables may have annotations on them; yours is
"package private" not private.

On 5/4/07, Michael Maier <[EMAIL PROTECTED]> wrote:

Hi List,

I'm trying to inject via @Inject annotation a service (internal
service RequestPageCache) into a component:

public class Menu {

     @Inject("RequestPageCache")
     RequestPageCache requestPageCache;

     public String getPageName() {

         ComponentResources pageResources= resources.getPage
().getComponentResources();
         String pageClassName= pageResources.getCompleteId();
         Page page= requestPageCache.getByClassName(pageClassName);
         return page.getName();
     }
}

so...while rendering the page with the menu component

<div id="leftside">
     <div id="menu">
         <ul>
             <li>
                 ${pageName}
             </li>
         </ul>
     </div>
</div>

a null pointer exception occures, because "requestPageCache" is null.
What is getting wrong? Is RequestPageCache not injectable?

What I want: I just try to get the page of the component. Then the
menu component should highlight by providing a special css-class the
corresponding menu item of the <ul><li>-list for the active page.
Therefore the menu component must know the current page that is
rendered. In Tapestry 3 is just call the method getPage of the
component. Now every component has no parent class...

While we are talking about injection: the docs are a little bit
confusing:

@Inject
@Service("xxx") (which did not work with 5.0.3, because Service
annotation does not exist)

or

@Inject("xxx")

or

@Inject( "service:xxx" ) (what kind of prefixes (service:) exists and
what meaning have they?)

sometimes:
@Inject ("alias:request" )...is there somewhere a list with all
objects that are able to be injected from tapestry-core?

thanks for any help

cheers

Michael


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




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Reply via email to