SSI2 配置整合
一、创建 web project 项目名字随便,我起名叫 ssi2_test
二、搭建 struts2 的环境
a) 引入 struts2 需要的 jar 包,数据库连接包等
b) 加入 struts.xml 文件
c) 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 >
<package name ="default" namespace ="/" extends ="struts-default" >
<action name ="login" class ="com.cstp.action.LoginAction" >
<result name ="success" >/success.jsp </ result >
<result name ="error" >/error.jsp </ result >
</ action >
</ package >
</ struts >
d) 在 web.xml 文件中配置 struts2
e) web.xml 文件代码如下
<? xml version ="1.0" encoding ="UTF-8" ?>
<web-app version ="2.5"
xmlns ="http://java.sun.com/xml/ns/javaee"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
<filter >
<filter-name >struts2 </ filter-name >
<filter-class >org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAn
dExecuteFilter </ filter-class >
</ filter >
<filter-mapping >
<filter-name >struts2 </ filter-name >
<url-pattern >/* </ url-pattern >
</ filter-mapping >
<welcome-file-list >