Announcement Announcement Module
No announcement yet.
Accessing annotated Spring Beans in JSPs Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing annotated Spring Beans in JSPs

    I have a JSP that I need to gain access to a helper bean. I have been reading around, trying to figure out how best this can be accomplished.

    I have attempted to add the following to the bean's interface:
    @RooService(domainTypes = { })
    public interface ArtCategoryService {
    	public List<ArtCategoryModel> getCategoriesForMenuSelection(Long catId);
    Then I added the following to the applicationContext.xml:
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    	    <property name="exposeContextBeansAsAttributes" value="true"/>
    But I have tried several ways to call the getCategoriesForMenuSelection(), but it keeps returning blank. Also, when I put a breakpoint in any of my Controllers and look at whats in the session object, the attributes are actually empty. I don't think the mechanism for putting the bean into session scope is working quite right.

    Can someone tell me what I am missing, or point me to a good example on how to do this in Roo (or MVC, but definitely makes it easier if comparing apple to apples). Or, if you have a better way of getting a list of items in the menu.jsp within Roo, other than how I am trying to approach it, I am all ears.