码迷,mamicode.com
首页 > 系统相关 > 详细

myeclipse9 struts2配置

时间:2014-11-26 18:44:32      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   sp   java   on   

引用struts2所用到的jar

web.xml配置如下

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<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>/*</url-pattern>
    </filter-mapping>
  <listener> 
        <listener-class> 
            org.springframework.web.context.ContextLoaderListener 
        </listener-class> 
    </listener>
    

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
</web-app>

struts.xml  位置:放到src根目录下

<?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="test" extends="struts-default">
        <action name="aa" class="test.tt" method="getimage">
            <result name="ss">/index.jsp</result>           
        </action>
        <action name="bb" class="test.tt" method="getimage2">                              
        </action>
    </package>

</struts>

applicationContext.xml 放到WEB-INF目录上

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
</beans>

 

myeclipse9 struts2配置

标签:style   blog   http   io   ar   color   sp   java   on   

原文地址:http://www.cnblogs.com/lvlv/p/4123696.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!