It is possible the use the menu in non-struts applications. I have succeeded to do this in the following way with Spring: There is a MenuPlugin class used by struts. Because it depends on Plugin interface from struts, and wanted to not depend at all on struts, I created a new class:

 

public class MenuConfigurer extends WebApplicationObjectSupport {

}

 

It does the same as MenuPlugin but does not depend on struts. MenuPlugin has as member struts’ ActionServlet just for getting the servlet context. Why not use the servlet context instead? There is no ActionServlet in non-struts applications.

The ActionServlet caused a further complication, having to subclass the MenuRepository class and override the load() method since it checks the servlet against null.

 

The ‘menu-config.xml’ can be provided in Spring’s xml configuration:

 

  <bean id="menu" class="com.xxx.MenuConfigurer">

      <property name="menuConfig">

        <value>/WEB-INF/menu-config.xml</value>

      </property>

  </bean>

 

That’s all.

 

Dan

Reply via email to