- 浏览: 118730 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (135)
- java (135)
- [转]c# 画圆角矩形 (1)
- 设计模式生活实例 (1)
- .nET2.0小技巧 (1)
- 从另一个角度看敏捷实践(一)--IPM:承诺的仪式 (1)
- javascript字符串转json对象 (1)
- 使用BeanUtils时,Date类型值为空的解决方法 (1)
- Lenovo V460+Ubuntu 11.10 无线网问题 (1)
- Lucene 索引和搜索过程核心类详解 (1)
- Android短信编解码方式 (1)
- 股神巴菲特十大致富秘籍 (1)
- Map遍历的三种方法 (1)
- Android中用Toast.cancel()方法优化toast内容的显示 (1)
- ViewFlipper “Receiver not registered” Error (1)
- javax.xml.transform.TransformerFactoryConfigurationError (1)
- JNI调用的注意事项 (1)
- JUnit单元测试感悟 (1)
- 用C#写定时关机的程序 (1)
- ASP.NET开发工具Web Matrix介绍 (1)
- MapXtreme2004代码 MapControl控件中显示地图文件 (1)
- 《使用 Microsoft .NET 的企业解决方案模式》读书笔记3 (1)
- 微创短信开发平台 (1)
- 谈谈Q+平台的技术实现 (1)
- 手机防盗软件实现(源码) (1)
- 虚析构函数(总结 帖子) (1)
- c语言中去除const修饰 (1)
- ORA-01012: not logged on 解决办法 (1)
- paypal提现如何省钱 (1)
- 数独suduku (1)
- MyISAM InnoDB 区别 (1)
- 随 笔 (1)
- Android上的log,日志相关 (1)
- 百度质量部实习居然通过了~ (1)
最新评论
-
野狐禅:
ext.get('imagebrowse') is null
ExtJs上传图片预览功能 -
zhuyl_wind:
不切实际,呵呵
[]5年内买车买房-理财篇 -
in南京:
关键你那两千块钱就够交一个多月的房租!换个城市你那六百也远远不 ...
[]5年内买车买房-理财篇 -
javac_xinyun:
呵呵,看完了,确实不错,貌似第一年的房租每月算进去 ,人际关系 ...
[]5年内买车买房-理财篇 -
dishikun:
貌似很不错,就是没把房租算进去!
[]5年内买车买房-理财篇
//官网参考地址:http://directwebremoting.org/dwr/index.html
<h1 style="font-size: 150%;">direct web remoting</h1>dwr is a java library that enables java on the server and javascript in a browser to interact and call each other as simply as possible.
dwr is easy ajax for java
dwr will generate the javascript to allow web browsers to securely call into java code almost as if it was running locally. it can marshal virtually any data including collections, pojos, xml and binary data like images and pdf files. all that is required is a security policy that defines what is allowed.
with reverse ajax, dwr allows java code running on a server to use client side apis to publish updates to arbitrary groups of browsers. this allows interaction 2 ways - browser calling server and server calling browser. dwr supports comet, polling and piggyback (sending data in with normal requests) as ways to publish to browsers.
dwr provides integration with spring, struts, guice, hibernate and others.
dwr is a rpc library which makes it easy to call java functions fromjavascript and to call javascript functions from java (a.k.a reverseajax).
dwr consists of two main parts:
- a java servlet running on the server that processes requests andsends responses back to the browser.
- javascript running in the browser that sends requests and candynamically update the webpage.
this method of remoting functions from java to javascript gives dwrusers a feel much like conventional rpc mechanisms like rmi or soap,with the benefit that it runs over the web without requiringweb-browser plug-ins.
<pre><create creator="new" javascript="jdate"> <param name="class" value="java.util.date"/> </create></pre>
the new creator that we used above uses the public no-args constructor that all javabeans must have. it is also worth remembering that dwr has one restriction:
- avoid reserved javascript words; methods named after reserved words are automatically excluded. most javascript reserved words are also java reserved words, so you won't be having a method called "try()" anyway. however the most common gotcha is "delete()", which has special meaning in javascript but not java.
the javascript attribute is required - it gives your newly created object a name in the browser. you should avoid using javascript reserved words.
the scope attribute is largely the same as the scope attribute as defined by the servlet spec. it allows you to specify what a bean is available to. the options are "application", "session", "request", "page" and an additional scope "script". the first 4 of these values should be familiar to servlet and jsp developers. "script" scope allows you to have something similar to an http session that is tied to an id in a page rather than in a cookie.
the scope attribute is optional. it defaults to "page".
dwr comes with some small javascript libraries to help you:
- engine.js: handles allserver communication
- util.js: helps you alterweb pages with the data you got from the server (and a few neat extrastoo)
http://directwebremoting.org/dwr/introduction/getting-started.html
//http://directwebremoting.org/dwr/documentation/browser/util/addoptions.html
//http://directwebremoting.org/dwr/documentation/browser/util/lists.html
//例子
下载2.0版本
根据下载的版本配置,也可根据上面来配置,但官网上配置的版本是3.0的,所以dwr.xml需从2.0中得到dtd。
重点是下载中的例子
在eclipse中运行项目,找出下面的内容(其中1、3是要掌握的,2一般少用):
tutorial style examples in this war file:
- dynamic text: a very simple documented example that updates a page with some text.
- resource forwarding: how to dynamically include the contents of one page in another.
- editable table: another simple documented example that allows the user to edit a table of data.
<script id="gtbtranslateelementcode">var gtbtranslateonelementloaded;(function(){var lib = null;var checkreadycount = 0;function sendmessage(message, attrs) { var data = document.getelementbyid(&quot;gtbtranslateelementcode&quot;); for (var p in attrs) { data.removeattribute(p); } for (var p in attrs) { if (&quot;undefined&quot; != typeof attrs[p]) { data.setattribute(p, attrs[p]); } } var evt = document.createevent(&quot;events&quot;); evt.initevent(message, true, false); document.dispatchevent(evt);}function checklibready (){ var ready = lib.isavailable(); if (ready) { sendmessage(&quot;gtbtranslatelibready&quot;, {&quot;gtbtranslateerror&quot; : false}); return; } if (checkreadycount++ &gt; 5) { sendmessage(&quot;gtbtranslatelibready&quot;, {&quot;gtbtranslateerror&quot; : true}); return; } settimeout(checklibready, 100);}gtbtranslateonelementloaded = function () { lib = google.translate.translateservice({}); sendmessage(&quot;{evt_loaded}&quot;, {}, []); var data = document.getelementbyid(&quot;gtbtranslateelementcode&quot;); data.addeventlistener(&quot;gtbtranslate&quot;, ontranslaterequest, true); data.addeventlistener(&quot;gtbtranslatecheckready&quot;, oncheckready, true); data.addeventlistener(&quot;gtbtranslaterevert&quot;, onrevert, true); checklibready();};function oncheckready() { var ready = lib.isavailable(); sendmessage(&quot;gtbtranslatelibready&quot;, {&quot;gtbtranslateerror&quot; : !ready});}function ontranslaterequest() { var data = document.getelementbyid(&quot;gtbtranslateelementcode&quot;); var orig = data.getattribute(&quot;gtboriginallang&quot;); var target = data.getattribute(&quot;gtbtargetlang&quot;); lib.translatepage(orig, target, onprogress);}function onprogress(progress, opt_finished, opt_error) { sendmessage(&quot;gtbtranslateonprogress&quot;, {&quot;gtbtranslateprogress&quot; : progress, &quot;gtbtranslatefinished&quot; : opt_finished, &quot;gtbtranslateerror&quot; : opt_error});}function onrevert() { lib.restore();}})(); (function(){var d=window,e=document;function f(b){var a=e.getelementsbytagname(&quot;head&quot;)[0];a||(a=e.body.parentnode.appendchild(e.createelement(&quot;head&quot;)));a.appendchild(b)}function _loadjs(b){var a=e.createelement(&quot;script&quot;);a.type=&quot;text/javascript&quot;;a.charset=&quot;utf-8&quot;;a.src=b;f(a)}function _loadcss(b){var a=e.createelement(&quot;link&quot;);a.type=&quot;text/css&quot;;a.rel=&quot;stylesheet&quot;;a.charset=&quot;utf-8&quot;;a.href=b;f(a)}function _isns(b){for(var b=b.split(&quot;.&quot;),a=d,c=0;c&lt;b.length;++c)if(!(a=a[b[c]]))return!1;return!0}function _setupns(b){for(var b=b.split(&quot;.&quot;),a=d,c=0;c&lt;b.length;++c)a=a[b[c]]||(a[b[c]]={});return a}d.addeventlistener&amp;&amp;typeof e.readystate==&quot;undefined&quot;&amp;&amp;d.addeventlistener(&quot;domcontentloaded&quot;,function(){e.readystate=&quot;complete&quot;},!1);if (_isns('google.translate.element')){return}var c=_setupns('google.translate._const');c._cl='zh-cn';c._cuc='gtbtranslateonelementloaded';c._cac='';c._cam='lib';var h='translate.googleapis.com';var b=(window.location.protocol=='https:'?'https://':'http://')+h;c._pah=h;c._pbi=b+'/translate_static/img/te_bk.gif';c._pci=b+'/translate_static/img/te_ctrl3.gif';c._phf=h+'/translate_static/js/element/hrs.swf';c._pli=b+'/translate_static/img/loading.gif';c._plla=h+'/translate_a/l';c._pmi=b+'/translate_static/img/mini_google.png';c._ps=b+'/translate_static/css/translateelement.css';c._puh='translate.google.com';_loadcss(c._ps);_loadjs(b+'/translate_static/js/element/main_zh-cn.js');})();</script>
发表评论
-
百度质量部实习居然通过了~
2012-02-08 12:23 985[size=small;]? ? ?本来打算在软工所苦 ... -
Android上的log,日志相关
2012-02-07 14:18 1524摘自:http://blog.csdn.net/met ... -
随 笔
2012-02-04 13:39 595金风玉露一相逢,便胜却人间无数。英文版: chemis ... -
MyISAM InnoDB 区别
2012-02-02 16:59 731<h1 id="artibody ... -
数独suduku
2012-01-31 14:38 914sudu sudu sudu sudu sudu su ... -
paypal提现如何省钱
2011-12-28 16:58 1221据PayPal中文注册得知,如今很多收样品费的外贸商户 ... -
ORA-01012: not logged on 解决办法
2011-12-28 13:08 3490<span style="font-f ... -
c语言中去除const修饰
2011-12-21 10:54 1425[size=16px;]<span style= ... -
虚析构函数(总结 帖子)
2011-12-21 09:54 698<span style="" ... -
手机防盗软件实现(源码)
2011-12-20 12:54 935<a href="http://blo ... -
谈谈Q+平台的技术实现
2011-12-20 09:49 960这篇文章是我个人 ... -
微创短信开发平台
2011-12-19 11:39 767在网上闲逛,发现了一个站点,微创短信开发平台(http ... -
《使用 Microsoft .NET 的企业解决方案模式》读书笔记3
2011-12-19 10:24 776第3章 Web表示模式 没有一个设计策略能够适合所有情 ... -
MapXtreme2004代码 MapControl控件中显示地图文件
2011-12-15 14:29 901::<?xml:namespace prefix ... -
ASP.NET开发工具Web Matrix介绍
2011-12-15 13:39 965<p class="MsoPlain ... -
用C#写定时关机的程序
2011-12-15 11:14 702</span></font>& ... -
JUnit单元测试感悟
2011-12-14 11:29 860<p class="MsoNorma ... -
JNI调用的注意事项
2011-12-14 09:34 749JNI的简单教程网上很多,看看就能够明白,照着操作也基 ... -
javax.xml.transform.TransformerFactoryConfigurationError
2011-12-13 13:34 848<span style="" ... -
ViewFlipper “Receiver not registered” Error
2011-12-12 10:59 1122偶尔出现这个错误: <span> < ...
相关推荐
Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr入门操作手册Dwr...
DWR(Direct Web Remoting)是一...通过学习这套DWR入门资料,你将能够熟练地使用DWR创建动态、交互性强的Web应用,提高开发效率,同时提升用户体验。实践中不断探索,理论与实战相结合,将助你在Web开发领域更进一步。
在DWR入门教程中,首先会介绍DWR的基本概念和工作原理。DWR的核心是将Java方法暴露给JavaScript,通过在服务器端创建一个称为"逆向Ajax"的通道,使得JavaScript能够调用远程服务器上的Java方法。这个过程涉及到几个...
**DWR入门步骤:** 1. **引入依赖**:首先,你需要在项目中添加dwr.jar到类路径中,这将包含所有DWR运行所需的类和库。 2. **配置DWR**:在Web应用的Web-INF目录下创建dwr.xml配置文件,设置允许的远程接口和方法...
在"DWR+dwr入门手册"中,你将深入了解到以下几个核心知识点: 1. **DWR的基本概念**:DWR的核心是Remoting Engine,它负责在客户端JavaScript和服务器端Java之间建立通信通道。DWR提供了一套API,包括`dwr.engine`...
在这个"DWR入门例子"中,我们将深入探讨如何使用DWR进行服务器和客户端之间的数据交换。 1. **DWR基本概念** - **反向AJAX**: DWR的核心理念是反向AJAX,即由服务器主动向客户端推送数据,而不仅仅是响应客户端的...
软件工程 DWR 入门教程 DWR(Direct Web Remoting)是一种基于 Java 的远程方法调用技术,它允许在 Web 应用程序中将 Java 对象作为远程服务暴露给客户端,客户端可以通过 Ajax 调用这些服务。下面是 DWR 入门教程...
STRUT2 DWR入门教程 DWR(Direct Web Remoting)是一种开源JavaScript库,它允许在Web应用程序中实现Ajax功能,使用户界面更加动态和交互性更强。与STRUT2框架结合使用,DWR可以为Java后端提供简单且高效的远程方法...
《DWR入门操作手册》深度解析与实践指南 一、DWR配置与使用基础 DWR,全称为Direct Web Remoting,是一种使Java对象能够直接从JavaScript调用的技术,简化了Ajax开发流程,使得前后端交互更为直接和高效。本文档...
**DWR(Direct Web Remoting)入门操作手册及DWR包** DWR,全称Direct Web Remoting,是一个...通过深入学习"Dwr入门操作手册"并实践使用"dwr.jar",你可以掌握如何利用DWR构建交互性更强、用户体验更好的Web应用。
这个“最完整的DWR入门文档及DWR使用案例”包含的资源无疑将帮助你深入理解和高效使用DWR。 首先,DWR的核心功能是提供了一种跨域的通信机制,使得前端JavaScript可以直接调用后端Java方法,就像操作本地函数一样,...
3. **DWR入门步骤**: - **准备环境**:首先,需要下载DWR的jar包,如dwrc.jar,将其放入项目的lib目录下。 - **创建Web项目**:创建一个新的Web项目,例如名为sayHello。 - **编写Java类**:创建一个名为...
在"DWR入门程序--计算两个数之和及包含页面的例子(使用1.0版本).rar"中,我们可以看到一个简单的例子,展示了如何使用DWR 1.0进行数据交互。这个例子可能包括一个HTML页面,该页面包含一个JavaScript函数,该函数...
在“dwr入门例子 返回list”这个主题中,我们将深入探讨如何使用DWR从服务器返回列表数据到客户端。列表通常包含多个项目,如数据库查询结果,这些数据可以在网页上以表格或其他形式展示给用户。DWR提供了方便的方法...
DWR入门涉及以下几个关键知识点: 1. **配置DWR**:首先,你需要在项目中集成DWR,这通常包括在`web.xml`中配置DWR的Servlet,以及在项目的类路径下创建`dwr.xml`配置文件,用于声明暴露给JavaScript的Java类和方法...
在"**dwr入门资料,简单入门,让你轻松掌握dwr**"的资源中,你可以期待学习到以下关键知识点: 1. **DWR的基本概念**:理解DWR的核心概念,如Remoting、Reverse Ajax和Caching,以及如何通过DWR实现浏览器与服务器...
本教程“DWR入门教程及实例(含源代码)”旨在帮助初学者快速掌握DWR的基本概念和使用方法。教程内容可能包括以下几个核心知识点: 1. **DWR概述**:讲解DWR的基本理念,如何通过HTTP协议实现JavaScript与Java之间...
这份"个人编写的一份dwr入门源代码"是针对初学者设计的,通过五个简单示例帮助理解DWR的基本用法和功能。 1. **DWR简介**:DWR简化了AJAX开发,通过自动处理跨域问题和JSON/JavaScript对象转换,使得前端可以像调用...
在本“DWR入门教程之HelloWorld”中,我们将逐步学习如何搭建一个简单的DWR应用,体验其基本功能。首先,我们需要了解以下关键组件: 1. **配置DWR**: 在Web应用程序的`web.xml`文件中,我们需要添加DWR的Servlet...