现在的问题是界面有个bean list 提取的时候显示 cannot find bean list in any scope
设system.out在action里面 发现根本没有运行到action里面<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
<form-beans>
<form-bean name="newsForm"
type="com.network.struts.form.NewsForm"/>
</form-beans>
<global-forwards>
<forward name="page" path="/page.do"/>
</global-forwards>
<action-mappings> <action path="/page" type="com.network.struts.action.ListNewsAction" scope="request">
<forward name="success" path="/category/news/index.jsp"/>
</action>
<action input = "/index.jsp"
path="/ListNewsAction"
type="com.network.struts.action.ListNewsAction"
name="newsForm"
parameter="methode"
scope="request"
validate="false">
<forward name="success" path="/category/news/index.jsp" />
</action>
</action-mappings>
<plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml"/>
</plug-in>
</struts-config> struts.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <!-- 原型的ShowAttackSolutionAction对象,通过get/set注入业务逻辑 -->
<bean name="/ListNewsAction"
class="com.network.struts.action.ListNewsAction"
singleton="false">
<property name="newsManager">
<ref local="NewsManager"></ref>
</property>
</bean>
<!-- 单例的AttackSolutionServices对象,通过get/set注入DAO -->
<bean id="NewsManager"
class="com.network.service.impl.NewsManager"
singleton="false">
<property name="newsDAO">
<ref local="NewsDAO"></ref>
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/studentnetworktest">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
</bean> <!-- Spring对Hibernate的支持,Spring对SessionFactory的封装 -->
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/network/model/News.hbm.xml</value>
</list>
</property>
</bean> <!-- Spring对Hibernate的支持,配置事务管理 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="SessionFactory" />
</property>
</bean> <!-- Spring对Hibernate的支持,DAO注入SessionFactory -->
<bean id="NewsDAO"
class="com.network.dao.hibernate.NewsDAO"
singleton="true">
<property name="sessionFactory">
<ref local="SessionFactory" />
</property>
</bean>
<!-- Spring对事务管理的支持,利用AOP为AttackSolutionDAO注入事务处理的工作 -->
<bean id="NewsDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="NewsDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans> applicationContext
设system.out在action里面 发现根本没有运行到action里面<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
<form-beans>
<form-bean name="newsForm"
type="com.network.struts.form.NewsForm"/>
</form-beans>
<global-forwards>
<forward name="page" path="/page.do"/>
</global-forwards>
<action-mappings> <action path="/page" type="com.network.struts.action.ListNewsAction" scope="request">
<forward name="success" path="/category/news/index.jsp"/>
</action>
<action input = "/index.jsp"
path="/ListNewsAction"
type="com.network.struts.action.ListNewsAction"
name="newsForm"
parameter="methode"
scope="request"
validate="false">
<forward name="success" path="/category/news/index.jsp" />
</action>
</action-mappings>
<plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml"/>
</plug-in>
</struts-config> struts.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <!-- 原型的ShowAttackSolutionAction对象,通过get/set注入业务逻辑 -->
<bean name="/ListNewsAction"
class="com.network.struts.action.ListNewsAction"
singleton="false">
<property name="newsManager">
<ref local="NewsManager"></ref>
</property>
</bean>
<!-- 单例的AttackSolutionServices对象,通过get/set注入DAO -->
<bean id="NewsManager"
class="com.network.service.impl.NewsManager"
singleton="false">
<property name="newsDAO">
<ref local="NewsDAO"></ref>
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/studentnetworktest">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
</bean> <!-- Spring对Hibernate的支持,Spring对SessionFactory的封装 -->
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/network/model/News.hbm.xml</value>
</list>
</property>
</bean> <!-- Spring对Hibernate的支持,配置事务管理 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="SessionFactory" />
</property>
</bean> <!-- Spring对Hibernate的支持,DAO注入SessionFactory -->
<bean id="NewsDAO"
class="com.network.dao.hibernate.NewsDAO"
singleton="true">
<property name="sessionFactory">
<ref local="SessionFactory" />
</property>
</bean>
<!-- Spring对事务管理的支持,利用AOP为AttackSolutionDAO注入事务处理的工作 -->
<bean id="NewsDAOProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="NewsDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans> applicationContext
解决方案 »
- 类似百度的登录和注册如何实现跪求大神帮忙
- hibernate annotation 索引
- spring 后置通知
- 明明注入了SessionFactory 为什么还是报这样的错误呀?'sessionFactory' or 'hibernateTemplate' is required
- 关于EJB3.0
- JSP 做视频流媒体服务器在线播放AVI,MP4,WMV格式,急求!!!
- 请教一个日志的问题(Logger)
- struts结果显示问题。
- 初学者,请教简单问题,在线等待
- wl7简单问题:新建application只有打包一种方式啦?
- 怎么从数据库读取一篇博文 ,然后把值传在一个页面的 txtarea
- pushlet comet 服务器推技术
value="classPath:applicationContext.xml"/>
直接报错啊亲
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/classPath:applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/classPath:applicationContext.xml]
java.io.FileNotFoundException: Could not open ServletContext resource [/classPath:applicationContext.xml]