日期:2014-05-20  浏览次数:20789 次

struts+spring 配置问题
我现在问题是这样的,我用STRUTS+HIBERNATE3+SPRING 做个登录功能,开始的时候我在spring的配置文件中只配置了/Login这一个bean,程序能够顺利跑完,后我加了一个DAO类,都还没引用他,就是下面那种情况,后来程序跑了之后就报HTTP Status 404 - Servlet action is not available 这是为什么呢,请大虾们讲解下


struts-config.xml
<struts-config>
<data-sources />
<form-beans>
<form-bean name="LoginFrom" type="com.my.web.struts.model.LoginFrom" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/Login" name="LoginFrom" input="/pages/login/login.jsp" 
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="success" path="/pages/login/test.jsp" />
</action>
</action-mappings>

<message-resources parameter="com.my.web.ApplicationResources"/>

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/conf/spring-bean.xml"/>
</plug-in>
</struts-config>

spring-bean.xml
<beans>
<bean name="/Login" class="com.my.web.struts.model.LoginActions"/>
<bean id="userLoginDao" class="com.my.web.daos.UserLoginDao"/> 加了这句就有问题...
</beans>





------解决方案--------------------
应该是userLoginDao注入到LoginActions有问题. 

------解决方案--------------------
@InjectObject("spring:AskDAO")
public abstract AskDAO getDao();
在用的时候,写成
AskDAO askDAO = getAskDAO();可以吗?