ssh整合问题?

隔夜的果酱_5566 2010-10-21 05:07:22
我整合了一个ssh,跑服务器的时候没什么问题?
但是进入一个页面, 一点提交,就报No WebApplicationContext found: no ContextLoaderListener registered?
这是为什么?
而且我在web.xml中也配置了
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>


请高手指导一下,还有我的spring是2.0的,是不是不同版本的spring 在web.xml中的配置也不一样啊?
谢谢,
...全文
150 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanyue198528 2010-10-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 pizan5566 的回复:]
Error creating bean with name 'userdao' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcepti……
[/Quote]

创建对象实例失败,你那个对象有get set么
注入前必须get set对象
hanyue198528 2010-10-22
  • 打赏
  • 举报
回复
创建对象实例失败,你那个对象有get set么
注入前必须get set对象
[Quote=引用 3 楼 cjoy4856 的回复:]
使用contextConfigLocation它的前提是已经配置好了监听器org.springframework.web.context.ContextLoaderListener
这样项目驱动的时间就会通过监听器加载spring的配置文件
[/Quote]
qinhualee 2010-10-22
  • 打赏
  • 举报
回复
你在UserdaoImp 中怎么使用 sessionFactory的
  • 打赏
  • 举报
回复
Error creating bean with name 'userdao' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.dao.imp.UserdaoImp]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

配上之后为什么报这个错误呢?

<!-- 登陆操作 -->
<bean id="userdao" class="com.dao.imp.UserdaoImp">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- action的操作 -->
<bean name="/login" class="com.web.action.TestAction">
<property name="userdaoserver" ref="userdao"></property>
</bean>

我在applicationContext.xml中配置了啊,为什么呢?
cjoy4856 2010-10-21
  • 打赏
  • 举报
回复
使用contextConfigLocation它的前提是已经配置好了监听器org.springframework.web.context.ContextLoaderListener
这样项目驱动的时间就会通过监听器加载spring的配置文件
hanyue198528 2010-10-21
  • 打赏
  • 举报
回复
本人项目里的一小段:
<!-- 配置Spring的监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- 配置Spring上下文 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
qianyecq 2010-10-21
  • 打赏
  • 举报
回复
貌似要加上

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧