读书人

帮忙见见applicationContext.xml

发布时间: 2013-04-12 18:33:11 作者: rapoo

帮忙看看applicationContext.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">
<beans>
<bean id="login" class="org.LoginAction">
</bean>
</beans>


这段代码有错吗?
[解决办法]
<?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">
<beans>
<bean id="login" class="org.LoginAction">
</bean>
</beans>
</web-app>
[解决办法]
应该是
<beans 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">
<bean id="login" class="org.LoginAction">
</bean>
</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" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
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-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
[解决办法]
web-app是web.xml里的最外层标记,beans是spring配置文件的标记,复制粘贴都找不对地方吗?
[解决办法]
第一:你是用什么软件开发的?myeclipse,可以自动生成配置文件,那样你就可以自动生成一个看看标签是否正确,第二:如果你用eclipse开发,你下载的spring,的完整的包中有application.xml配置,可以复制一个过来看看标签是否正确。
[解决办法]

引用:
这是struts2和spring整合开发的applicationContext.xml 文件,不知道为什么会错

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="login" class="org.LoginAction">
</bean>
</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"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">





</beans>

这是spring2.5 的包里自带的,给你复制个,
[解决办法]
这种东西 你有必要自己敲吗?还有 这多个中文字符啥的也看不出来 ,果断粘贴复制就ok了

读书人网 >J2EE开发

热点推荐