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(); }

  • ExtJs direct push DEMO 2011-09-15

    Other codes see annex <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css"

  • 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.setContent

  • 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.DOMDoc

  • Zen Coding css,html缩写替换大观 快速写出html,css 2014-09-02

    本文是在zen使用生产中遇到的问题做一些分享. 阅读本文,先仔细阅读网站文章. Zen Coding 快速编写HTML/CSS代码的实现 E 元素名称(div, p); E#id 使用id的元素(div#content, p#intro, span#error); E.class 使用类的元素(div.header, p.error.critial). 你也 可以联合使用class和idID: div#content.column.width; E>N 子代元素(div>p, div#foot

  • 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

  • Getting Started with DWR 2009-09-01

    http://getahead.org/dwr Official Website http://baike.baidu.com/view/73492.htm?fr=ala0_1_1 index.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>DWR Getting started </TITLE>

  • 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' decimal

  • DWR developed using Ajax-based file upload portlet in 2010-03-30

    <script type="text/javascript"> document.body.oncopy = function () (if (window.clipboardData) (setTimeout (function () (var text = clipboardData.getData ( "text"); if (text & ; & text.length> 300) (text = text + "

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

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

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

processed in 0.506 (s). 10 q(s)