首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts框架配备

2012-09-21 
Struts框架配置第一步:导入struts的jar包(在我添加的附件s.rar中)第二步:配置web.xml:如下:?xml version

Struts框架配置
第一步:导入struts的jar包(在我添加的附件s.rar中)
第二步:
配置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>struts</filter-name>
  <filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>struts</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>
备注:
主要是过滤器的配置
<filter-name>struts</filter-name>
过滤器名字是自己起的
类名是struts中的jar包的包名加类名(在struts的jar包中可以找到)
  <url-pattern>一般都是用/*
第三步:
在src目录下创建struts.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC  
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" 
"http://struts.apache.org/dtds/struts-2.1.dtd"> 
<struts>

</struts>

好了,做好这三步,struts框架就搭建好了。。。 1 楼 qiu4160240 2010-10-11   标题应该是: “struts2框架配置” ,学习啦

热点排行