`
xiaotao.2010
  • 浏览: 211969 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Struts-笔记-2

阅读更多

2 . 搭建 Struts 开发环境

  2.1 搭建环境

l          导入 jar 包。

 

Add Library 导入 jar

 

l          建立一个配置文件: struts-config.xml

 

<? xml version = "1.0" encoding = "UTF-8" ?>

 

<! DOCTYPE struts-config PUBLIC

          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"

          "http://struts.apache.org/dtds/struts-config_1_3.dtd" >

 

< struts-config >

  < form-beans />

    < action-mappings >

    </ action-mappings >

</ struts-config >

路径: /WebRoot/WEB-INF/lib/…

 

 

l          配置: 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" >

    < servlet >

       < servlet-name > action </ servlet-name >

       <!-- 使用 struts 中的 servlet -->

        < servlet-class > org .apache .struts.action.ActionServlet </ servlet-class >

       <!-- 加载启动文件 -->

       < init-param >

           < param-name > config </ param-name >

           < param-value > /WEB-INF/struts-config .xml </ param-value >

       </ init-param >

       <!-- 0 表示已启动就加载文件 -->

       < load-on-startup > 0 </ load-on-startup >

    </ servlet >

   

    < servlet-mapping >

       < servlet-name > action </ servlet-name >

       < url-pattern > *.do </ url-pattern >

    </ servlet-mapping >

</ web-app >

 

路径: /WebRoot/WEB-INF/lib/…

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics