Ajax is simple and practical framework of DWR

1. First of all, on the site to download the relevant jar package, dwr.jar, the jar package on the project under the lib directory

2. Write dao, service

dao methods:

/ *
* Based on the information store queries bsoid
* /
public JfFranInfo findByBsoid (Long bsoid) (
return (JfFranInfo) getHibernateTemplate (). get (JfFranInfo.class, bsoid);
)

The method of service:

/ *
* DWR to use, according to the current user bsoid inquiries balance inquiries
* /
public double findInfoByBsoid (long bsoid) (
JfFranInfo franinfo = jfFranInfoDAO.findByBsoid (bsoid);
double balance = franinfo.getFranBalance ();
return balance;
)

3. Is the dwr configuration file, and pay attention to dwr.xml name is on the WEB-INF directory

<? xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE dwr PUBLIC "- / / GetAhead Limited / / DTD Direct Web Remoting 2.0 / / EN" " http://getahead.org/dwr/dwr20.dtd ">
<dwr>
<allow>
<create creator="spring" javascript="PaymentManagerService">
<param name="beanName" value="PaymentManagerService"/>
<include method="findInfoByBsoid"/>
</ create>
</ allow>
</ dwr>

Should be introduced 4.JSP

<script type = "text / javascript" src ="<%= request.getContextPath ()%>/ dwr / interface / PaymentManagerService.js "> </ script>
<script type = "text / javascript" src ="<%= request.getContextPath ()%>/ dwr / engine.js "> </ script>
<script type = "text / javascript" src ="<%= request.getContextPath ()%>/ dwr / util.js "> </ script>
5. To perform the operation with event-triggered

js in writing:

function checkBalance () (
var bsoid = $ ( 'bsoid'). value;
PaymentManagerService.findInfoByBsoid (bsoid, callback);
)
function callback (msg) (
DWRUtil.setValue ( 'balance', msg);
)

JS page to add a reference

<script type = "text / javascript" src ="<%= request.getContextPath ()%>/ script / findBalance.js "> </ script>
Trigger events in the page with the location of onclick = "checkBalance ()". On the OK

Ability to express himself very poor, and if the statements do not understand, please forgive

分类:AJAX 时间:2009-07-08 人气:317
分享到:
blog comments powered by Disqus

相关文章

  • AJAX response processing to return XML 2010-12-03

    Ajax request, the server returns data in XML form, the page will be very easy to deal with Javascript. Code: // Send request var req; function getXMLHttpRequest() { var xRequest = null; if (window.XMLHttpRequest) { xRequest = new XMLHttpRequest(); } else

  • servlet in the web.xml configuration file parameters in context-param and the init-param District 2010-06-17

    web.xml which can be defined two parameters: (1) application within the parameters stored in servletcontext, in web.xml, configured as follows: <context-param> <param-name> context / param </ param-name> <param-value> avalible

  • FCKEditor editor to use (a) 2010-12-26

    JS We need to first download the file and the JAR package 1): FCKeditor_2.6.4.zip Address: http://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip 2): fckeditor-java-2.4.1-bin.zip (JAVA Support Package) address http://nchc.dl.sourceforge.

  • js 获取计算后的样式写法及注意事项 2014-12-17

    复合样式:currentStyle;注意在获取复合样式时要单独写,不能写background,接下来将详细介绍下实现方法,感兴趣的你可不要错过了哈 currentStyle 1.复合样式:currentStyle取不到 例:background、margin 2.取默认样式 3.只能读 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <ti

  • Ajax Asynchronous Request Server (jquery) server returns data in xml format 2010-03-21

    New jslib the WebRoot directory folder: the lib into the jquery library, verifyjqueryxml.js (script file) ajaxjqueryxml.html file code is as follows: <! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN" " http://www.w

  • Ajax Learning (xml application) 2010-12-18

    / / Server ................ public class AJAXXmlServer extends HttpServlet { protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //============= Written text / xml response.setContentType

  • JS解析XML文件和XML字符串详解 2014-08-06

    这篇文章主要介绍了JS解析XML文件和XML字符串详解,推荐给大家,有需要的小伙伴可以参考下。 JS解析XML文件 <script type='text/javascript'> loadXML = function(xmlFile){ var xmlDoc=null; //判断浏览器的类型 //支持IE浏览器 if(!window.DOMParser && window.ActiveXObject){ var xmlDomVersions = ['MSXML.2.D

  • DWR Chinese document. Rar 2009-08-10

    DWR Chinese document v0.9 DWR 2.0 Edited by Wei Flocity Part original / part of finishing / partial translation Copyright Notices The book version of the current distribution network only, completely free of charge, please specify author information repro

  • 2010.03.10 (2) - FusionChartsFree simple usage 2008-07-28

    2010.03.10 (2) - FusionChartsFree simple usage Reference: http://bbs.cnw.com.cn/viewthread.php?tid=159992 The first step: Create an XML data document first.xml <graph caption=' Monthly sales histogram ' xAxisName = ' month ' yAxisName='Units' decimalPr

  • 2010.03.11 (3) - FusionChartsFree get it from the background data and dynamic data source 2009-08-01

    2010.03.11 (3) - FusionChartsFree get it from the background data and dynamic data source To do this today from the inside, learned two important points, 1. So that there is always a check box is check the // Judge check box must be at least one item sele

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.359 (s). 12 q(s)