警告: Can't find ServletContext to check for <welcome-file-list> in web.xml.

本文详细介绍了在使用DWR技术进行Reverse Ajax开发时,遇到的在初始化web.xml时找不到ServletContext的问题,并提供了解决方案。通过在代码中加入特定的初始化逻辑,可以避免此警告出现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


警告: Can't find ServletContext to check for <welcome-file-list> in web.xml. Assuming defaults.
2011-9-30 14:21:32 org.directwebremoting.impl.DefaultPageNormalizer normalizePage
警告: - To prevent this message from happening, either call the PageNormalizer from a DWR thread
2011-9-30 14:21:32 org.directwebremoting.impl.DefaultPageNormalizer normalizePage
警告: - Or seed the PageNormalizer with a ServletContext before access from outside a DWR thread


因为使用了dwr的推送技术,在初始化web.xml时就需要将类初始化,而这个时候根本就没有网页调用这个类,当然报这样的错误了。

解决方法参考如下:[url]http://directwebremoting.org/dwr/documentation/reverse-ajax/threads.html[/url]
添加如下红色内容即可

WebContext wctx = WebContextFactory.get();
sctx = ServerContextFactory.get(wctx.getServletContext());
[color=red]wctx.getScriptSessionsByPage("");[/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值