m-value>
</context-param>
<!--struts过滤器 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<!-- 加载spring配置文件 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 设置欢迎页 -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
3.添加struts.xml配置文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.objectFactory" value="spring" />
<include file="struts/user.xml"></include>
</struts>
4.配置 user.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="user" namespace="/user" extends="struts-default">
<action name="login" class="userAction" method="login">
<result name="input">/login.jsp</result>
<result name="success" type="redirect">/welcome.jsp</result>
</action>
</package>
</struts>
SSH永芝膨 屁栽struts2(3)
扮寂:2011-01-18 BlogJava ju
5.耶紗UserAction才UserManager窃
package net.selitech.ssim.web.user;
import java.util.Map;
import net.selitech.ssim.dao.SsimUser;
import net.selitech.ssim.user.UserManager;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* @author: juxuejian
* @filename: UserAction.java
* @date: Aug 10, 2009 , 11:10:47 PM
* @description :
*/
public class UserAction extends ActionSupport{
SsimUser user;
UserManager userManager;
public String login(){
if(getSession("loginedUser")!=null) return SUCCESS;
try {
if (get
|