日期:2014-05-17 浏览次数:20754 次
<bean id="userDao" class="com.quxiuna.dao.impl.UserDaoImpl"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <bean id="userService" class="com.quxiuna.service.impl.UserServiceImpl"> <property name="userDao"> <ref local="userDao" /> </property> </bean> <bean id="loginAction" class="com.quxiuna.struts.action.login.LoginAction" scope="prototype"> <property name="userService"> <ref local="userService" /> </property> </bean>
<struts> <constant name="struts.objectFactory" value="spring" /> <constant name="struts.devMode" value="true" /> <constant name="struts.objectFactory.spring.autoWire" value="type" /> <include file="struts-default.xml"/> <include file="com/quxiuna/struts/action/login/loginAction.xml" /> </struts>
<struts> <package name="login" extends="struts-default" namespace="/login"> <action name="loginAction" class="com.quxiuna.struts.action.login.LoginAction"> <result name="success">/sendSuccss.jsp</result> </action> </package> </struts>
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext*.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
public class UserServiceImpl implements UserService { public UserDAO userDao; public UserDAO getUserDao() { return userDao; } public void setUserDao(UserDAO userDao) { this.userDao = userDao; }
package com.quxiuna.struts.action.login; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.quxiuna.hibernate.po.RbacUser; import com.quxiuna.service.UserService; import com.quxiuna.util.Constants; public class LoginAction extends ActionSupport { private static final long serialVersionUID = -1640288447822607013L; private String name; private String password; private String message; public UserService userService; public String getName() { return name; }