最近在学习spring集成struts。
我用spring1.2集成struts1已经成功了,各部分功能都运行正常。
听说spring版本是向下兼容的,然后我把spring的相关包都删了,把spring2.0所有包都导入了(因为初学,不知道哪些包要用到)。这个时候还是能运行正常的。
要用到2.0配置的新特性是要改一下配置文件头的吧?
于是我把spring配置文件头的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans >

改成了
<?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.0.xsd">

然后启动,启动的时候没有报错,但是访问的时候出现
 Servlet action is not available
改这个文件头的时候一切正常啊,这是什么问题呢?
还有这个文件头的含义是什么?下载帮助信息还是其它什么?找了好久都没文章解释这个,请前辈们帮下忙

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-contexts-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    拷贝这个看看