I have two actions in two different packages
<package name="default" extends="struts-default json-default" namespace="/">
<action name="getstarted" class="GetStartedActionBean">
<result name="success">/jsp/getStarted.jsp</result>
<result name="input">/jsp/getStarted.jsp</result>
</action>
</package>
<package name="example" extends="json-default">
<action name="searchIndustryaction" class="GetStartedActionBean" method="searchIndustry">
</action>
</package>
I have injected one bean it is working fine when the page loads but my search is through dwr at that time bean is not injected
in my impl
private SessionFactory sessionfactory;
public void setSessionfactory(SessionFactory sessionfactory) {
this.sessionfactory = sessionfactory;
}
sessionFactory
is set when the execute method is called but using dwr when i called searchIndustry
sessionfactory
is always null
Dwr entry
<create creator="new" javascript="AdvancedSearch" scope="application">
<param name="class" value="com.sample.dao.impl.IndustryDAOImpl"/>
</create>
How would I call the injected bean in dwr?
If you are using DWR means you have to put an entry like this
<create creator="spring" javascript="Industry">
<param name="beanName" value="Yourbeanname" />
</create>
but you are directly calling the class so change to this format. Hope it may useful for you