Atitit. Ajax bp dwr 3. annotation configuration process summary .....

Source: Internet
Author: User

Atitit. Ajax bp dwr 3. annotation configuration process summary .....

 

1. Download DWR. Jar 1 M 1

2. Configure the annotation method... web. xml 1

3. class configuration 2

4. Test and view published method 2

5. Import to page 3

6. Use in JS blackhead 3

7. #===== Param sh requesst 3

8. XXX is undefine 4

9. Warning: overloaded methods are not recommended 4

 

1. Download DWR. Jar 1 m

Development release: Version 3 Release Candidate 2 (3.0 RC2)

2. Configure the annotation method... web. xml

<! -- O71 -->

<Servlet>

<Display-Name> DWR servlet </display-Name>

<Servlet-Name> DWR-invoker </servlet-Name>

<Servlet-class> org. directwebremoting. servlet. dwrservlet </servlet-class>

<Init-param>

<Param-Name> debug </param-Name>

<Param-value> true </param-value>

</Init-param>

<Init-param>

<Param-Name> allowimpossibletests </param-Name>

<Param-value> true </param-value>

</Init-param>

<! -- Place the annotation-set domain objects and business implementation classes in the following list, and use commas (,) to separate them. -->

<Init-param>

<Param-Name> classes </param-Name>

<Param-value>

Com. focustar. Service. awdsvs_shake_perdaymode

</Param-value>

</Init-param>

</Servlet>

 

<Servlet-mapping>

<Servlet-Name> DWR-invoker </servlet-Name>

<URL-pattern>/DWR/* </url-pattern>

</Servlet-mapping>

Author: old wow's paw attilax iron, email: [email protected]

Reprinted please indicate Source: http://blog.csdn.net/attilax

 

3. class configuration

@ Remoteproxy (name = "awdsvs_shake_perdaymodeprox ")

Public class awdsvs_shake_perdaymode

// 5:31:28 old wow's paw attilax

@ Remotemethod Public String leftnum_noreq (string uid, string actid ){

 

 

4. Test and view published methods

Http: // 192.168.1.63/Weixin/DWR/index.html

Modules known to DWR:

· Awdsvs_shake_perdaymodeprox (newcreator for com. focustar. Service. awdsvs_shake_perdaymode)

 

Click class K to see the method one tile... you can test a single method... stub has OK...

View the detailed call parameters. No JS download is allowed. No http: // 192.168.1.63/Weixin/DWR/interface/awdsvs_shake_perdaymodeprox.js download ..

 

 

5. Import to page

View Source code...

Copy ..

<SCRIPT type = 'text/JavaScript 'src = '/Weixin/DWR/engine. js'> </SCRIPT>

<SCRIPT type = 'text/JavaScript 'src = '/Weixin/DWR/interface/awdsvs_shake_perdaymodeprox.js'> </SCRIPT>

 

 

 

<SCRIPT type = 'text/JavaScript 'src = '/Weixin/DWR/util. js'> </SCRIPT>

 

 

6. Use in JS blackhead

Awdsvs_shake_perdaymodeprox.startdraw_noreq (openid, actid, function (data)

{

// Alert (data );

// Var data_json = eval (data );

VaR data_json = eval ("(" + Data + ")");

// Alert (data_json.code );

Drawaftevent (data_json );

}

);

 

7. #===== Param sh requesst

 

Do not download http: // 192.168.1.63/Weixin/DWR/interface/awdsvs_shake_perdaymodeprox.js ..

/**

* @ Param {function | object} callback function or options object

*/

P. leftnums = function (callback ){

Return DWR. Engine. _ execute (P. _ path, 'awdsvs _ shake_perdaymodeprox', 'leftnums', arguments );

};

 

 

Directly pass callback to OK lan...

The sub-database can have no rewrite scheme, and directly transmits the class K without parameters...

 

8. XXX is undefine

Thourng yeu trace L. I don't know why the trace doesn't go up... maybe it's too deep...

 

It turns out that JS can directly show pulling Lee undefine...

 

So I had to debug the FF blackhead step... but I still had to catch up with the fire. Can I debug it...

 

 

9. Warning: overloaded methods are not recommended

JavaScript does not support overloaded methods, so the Javascript file generated from this class will contain in two methods the second of which will replace the first. This is probably not what you wanted.

It is best to avoid overloaded methods when using DWR.

3.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.