<!-- 注入DAO层 -->
<bean id="LongtuDAO" class="com.lt.dao.impl.LongtuDAOimpl" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 注入service层 -->
<bean id="LongtuService" class="com.lt.service.impl.LongtuServiceimpl" scope="prototype">
<property name="longtuDAO">
<ref bean="LongtuDAO"/>
</property>
</bean>
<!-- 注入action -->
<bean id="testAction" class="com.lt.action.TestAction" scope="prototype">
<property name="longtuService">
<ref bean="LongtuService"/>
</property>
</bean>

解决方案 »

  1.   

    public String save(){
    longtuService.save(longtu);
    return "save";
    }
      

  2.   

     <s:form action="test" method="post">
         <table align="center">
         <tr>
         <td>用户名:</td>
         <td><s:textfield name="username"></s:textfield></td>
         </tr>
         <tr>
         <td>密码:</td>
         <td><s:password name="password"></s:password></td>
         </tr>
         <tr>
         <td>性别:</td>
         <td><s:select name="sex" list="{'男','女'}" headerKey="-1" headerValue="-保密-"></s:select></td>
         </tr>
         <tr>
         <td>年龄:</td>
         <td><s:textfield name="age"></s:textfield></td>
         </tr>
         <tr>
         <td>生日:</td>
         <td><s:textfield name="birthday"></s:textfield></td>
         </tr>
         <tr>
         <td>爱好:</td>
         <td><s:textfield name="hobby"></s:textfield></td>
         </tr>
         <tr>
         <td><s:submit></s:submit></td>
         <td><s:reset></s:reset></td>
         </tr>
         </table>
        </s:form>
      

  3.   

    struts.xml<constant name="struts.objectFactory" value="spring"></constant>
      

  4.   

    <bean id="testAction" class="com.lt.action.TestAction" scope="prototype">这个class路径在却认下 ,这个类找不到 TestAction T是大些的 报的是小写的找不到,你类名是什么?
      

  5.   


    action的类名是TestAction
    但是注入到Spring里的id是testAction啊  
      

  6.   

    把TestAction过一遍 哪里写的小写 咋报小写的找不到啊?