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...
Code: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; @Override 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...
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...Code:<bean id="genericHibernateDAO" class="ro.dao.hibernate.GenericHibernateDAO" abstract="true" autowire="no"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <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" /> </bean>
is also in ro-data.xml...Code:<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" />
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
If I, however, set the definition with the preparer attribute this wayCode:<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" /> </definition>
the same name as the bean what is more logical, when debugging, the program doesn't even enter in the OperatorActionListing class...Code:preparer="operatorActionListing"
By the way, this is the tilesConfigurer:
Finally, i can add that I have set these properties in struts.properties... I don't know whether they are correct...Code:<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/tiles.xml</value> </list> </property> <property name="preparerFactoryClass" value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" /> </bean>
any ideas to help me?Code:struts.objectFactory=spring struts.objectFactory.spring.autoWire=auto
Thank you.


Reply With Quote
