容器:容纳符合规格的东西器皿。servlet容器:能放置servlet的“器皿”,servlet必须符合servlet的一些规格。
HttpServlet是servlet容器中最基本的类型了,只要继承HttpServlet便可以被容器执行,当然首先你得在该容器的配置文件web.xml中做一些声明:
liveServlet
net.live51.LiveServlet
beanFactoryConfig
./services-config.xml
1
以上片断是做了一个servlet-name为liveServlet的声明,指明了实际处理的类,当然net.live51.LiveServlet是继承了HttpServlet的,其中init-param和load-on-startup为高级用法,以后在讲到,将以上配置简化一下:
liveServlet
net.live51.LiveServlet
这样也是可行的。
定义好了如何使用呢?
In dwr sites, it tell use three way to use dwr with spring. But the important details are ignored on his suggest way.
If you are using spring and have your private spring bean manger.how to use DWR?
- define a spring bean implements BeanFactoryPostProcessor
- overwrite postProcessBeanFactory function
- call SpringCreator.setOverrideBeanFactory(beanFactory)
the code was just like this:
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import uk.ltd.getahead.dwr.create.SpringCreator;
/** * @author summer * */
public class DWRSpringIntegrator implements BeanFactoryPostProcessor {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
SpringCreator.setOverrideBeanFactory(beanFactory);
}
}
pagelist tool is used for build pages.
when your data have lots of pages, you could use this tool easily build pagelist to browse your pages.
I suggest use it with DWR, using DWR get serer page content, using this pagelist tool to diplay next page item.
you could download it.
Direct Web Remoting
DWR允许使用客户端Javascript来与服务端Java程序进行交互,他实际上是帮助开发者隐藏了很多的开发细节。 不用辛苦的去使用XMLHTTP,DWR是客户端-服务端的AJAX比较好的解决方案。
DWR官方网站:
http://getahead.ltd.uk/
DWR文档中文翻译最佳网站:
http://wiki.javascud.org/display/dwrcn/Home
评论