Announcement Announcement Module
No announcement yet.
Struts 2 + Tiles 2 + Spring 3, Tiles ViewPreparer bean not found. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Struts 2 + Tiles 2 + Spring 3, Tiles ViewPreparer bean not found.

    I'm trying to integrate these technologies, I'm having problems with the "ViewPreparer" classes that list the results from queries...

    When this class tries to get customerDAO it cannot find it because it hasn't been injected...

    package ro.action.list;
    import org.apache.tiles.AttributeContext;
    import org.apache.tiles.context.TilesRequestContext;
    import org.apache.tiles.preparer.PreparerException;
    import org.apache.tiles.preparer.ViewPreparerSupport;
    import ro.dao.CustomerDAO;
    import ro.model.Operator;
    public class OperatorActionListing extends ViewPreparerSupport {
    	private CustomerDAO customerDAO;
    	public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext)
    			throws PreparerException {
    		Operator operatorExample = (Operator) tilesContext.getRequestScope().get("operatorExample");
    		if(operatorExample == null) {
    			tilesContext.getRequestScope().put("operators", getCustomerDAO().findConcrete(Operator.class));
    		} else {
    			tilesContext.getRequestScope().put("operators", getCustomerDAO().findConcreteByExample(operatorExample, Operator.class));
    	public CustomerDAO getCustomerDAO() {
    		return customerDAO;
    	public void setCustomerDAO(CustomerDAO customerDAO) {
    		this.customerDAO = customerDAO;

    This are most of the beans implied...
    	<bean id="genericHibernateDAO" class="ro.dao.hibernate.GenericHibernateDAO" abstract="true" autowire="no">
    		<property name="sessionFactory" ref="sessionFactory" />
    	<bean id="customerDAO" class="ro.dao.hibernate.CustomerDAOHibernate" parent="genericHibernateDAO" autowire="no"/>
    	<bean id="operatorActionListing" class="ro.action.list.OperatorActionListing" scope="prototype" autowire="no"> 
    		<property name="customerDAO" ref="customerDAO" />
    I have put these beans together here but genericHibernateDAO is in ro-data.xml, while the other beans are in ro-servlet.xml. I don't know if this has something to do with anything, by the way... Besides as I'm using tomcat, the...

    <context:load-time-weaver weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" />
    is also in ro-data.xml...

    I get a warning that says that javax.* objects are not being woven but I don't know what this implies...

    This is the tiles definition

    	<definition name="OperatorActionListing" extends="administratorBase" preparer="model.action.list.OperatorActionListing">
    		<put-attribute name="title" value="Operators Listing" />
    		<put-attribute name="body" value="/jsp/administrator/operatorList.jsp" />
    If I, however, set the definition with the preparer attribute this way

    the same name as the bean what is more logical, when debugging, the program doesn't even enter in the OperatorActionListing class...

    By the way, this is the tilesConfigurer:

    	<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    		<property name="definitions">
    		<property name="preparerFactoryClass" value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" />
    Finally, i can add that I have set these properties in I don't know whether they are correct...

    any ideas to help me?

    Thank you.