struts 为什么用org.springframework.web.context.ContextLoaderListener才不会出错 struts 为什么用org.springframework.web.context.ContextLoaderListener才不会出错,郁闷知道的能说下吗,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是web.xml里要加入<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>而且要在lib下建立applicationContext.xml文件在这里struts和spring有什么关系 web.xml<?xml version="1.0" encoding="UTF-8"?><web-app 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>*.action</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<?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="ot" extends="struts-default"> <action name="hello" class="HelloAction"> <result name="success">/index.jsp</result> </action> </package></struts> 哈哈,这个我只得到:你的jar包里struts2-spring-plugin-2.0.11.1.jar如果你不用spring 就把类似这个包去掉如果你用spring就一定要加org.springframework.web.context.ContextLoaderListener 这个监听 如何将数据库里的数值转化为select oracle数据库BOLB数据转换String异常 jsp 页面文本框值累加 数据库记录的遍历问题,树结构 这个ejb ql语句怎么写????急!! 有了解这两个公司的同仁们 请进来 跪谢拉 小弟要毕业 不了解到说 tomcat集成iis,图片不显示?? 关于javamial发送邮件的背景图片的问题! 谁有《j2ee1.4标准教材》的示例代码吗?请给我一份 在webstart中加载图片的问题 FTP问题 高分跟诚心寻找精通SUPERSITE的人,完善X-SPACE的细节,谢谢各位!谢谢啦!
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
而且要在lib下建立applicationContext.xml文件在这里struts和spring有什么关系
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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>*.action</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>
<?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="ot" extends="struts-default">
<action name="hello" class="HelloAction">
<result name="success">/index.jsp</result>
</action>
</package></struts>
如果你不用spring 就把类似这个包去掉
如果你用spring就一定要加org.springframework.web.context.ContextLoaderListener 这个监听