ajax与spring 结合
来源:互联网 发布:centos和ubuntu的区别 编辑:程序博客网 时间:2024/06/12 01:02
Spring的集成几乎异常简单,只需要更改配置文件而已.
页面的代码不用动,例如
doc.simple-spring.jsp
<script language="javascript">var springEndPoint="<%=request.getContextPath()%>/remoting/Spring-buffalo";function pageMethod() { var buffalo = new Buffalo(springEndPoint); buffalo.remoteCall("yourObject.yourMethod",[], function(reply) { var Obj = reply.getResult(); })}</script>
web部署描述文件
web.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app> <display-name>Buffalo Web Remoting Demostration Application</display-name><context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml</param-value></context-param><servlet><servlet-name>context</servlet-name><servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet><servlet-name>remoting</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><load-on-startup>4</load-on-startup></servlet><servlet-mapping><servlet-name>remoting</servlet-name><url-pattern>/remoting/*</url-pattern></servlet-mapping></web-app>
以前的buffalo-service.properties文件则不用,applicationContext.xml所替代之.其中引用到的bean可以是任意被Spring托管的bean.这个Controller可以被任意任意方式的ServletDispather调用.
applicationContext.xml
<beans><bean name="simpleService" class="net.buffalo.demo.simple.SimpleService"></bean><bean name="numberService" class="net.buffalo.demo.numberguess.NumberGuessService"></bean></beans>
remoting-servlet.xml
<beans> <bean name="/Spring-buffalo" class="net.buffalo.spring.BuffaloServiceExporter"><property name="services"> <map> <entry key="simpleService"> <ref bean="simpleService"/> </entry><entry key="numberService"> <ref bean="numberService"/> </entry> </map> </property> </bean></beans>
<script type="text/javascript"><!--google_ad_client = "pub-6769732252051080";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";//2007-01-24: www.csdn.netgoogle_ad_channel = "7833314861";//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- ajax与spring 结合
- Ajax与Spring的结合
- struts2与ajax结合
- AJAX-与setTimeout()结合
- struts2与spring结合
- struts2与spring结合
- flex与Spring结合
- strust与spring结合
- Spring与Struts结合
- ibatis-----与Spring结合
- Struts2 与spring结合
- DWR与Spring结合
- MyBatis与Spring结合:
- Spring与quartz结合
- Spring与Quartz结合
- Spring 与JDBC结合
- CXF 与Spring结合
- Spring与Hibernate结合
- Oracle常用命令
- Openlaszlo案例
- SPOON国外一本新锐时尚摄影杂志
- IM
- P2P communication across middleboxes(翻译)——感谢hxh(贺星河)
- ajax与spring 结合
- 工作一年多了,有什么变化啊
- 有钱怎么啦?就是牛!
- ViPER: The Video Performance Evaluation Resource
- arcgis中图层加载
- Exchange 2003安装
- AJAX简介
- One hunder of Web2.0 website
- FastReport使用手册