DWR Spring's integration implementation code _JAVASCRIPT skills

Source: Internet
Author: User
One, spring's proper use
Configuration of 1,dwr.xml
Copy Code code as follows:

<dwr>
<allow>
<!--dwr+spring-->
<create creator= "Spring" javascript= "Jcustomermanager" >
<param name= "Beanname" value= "Customermanager"/>
</create>
</allow>
</dwr>

Customermanager is the ID of the spring registration
2, page call
Copy Code code as follows:

<script type= "Text/javascript" >
Function Manager () {
Jcustomermanager.deletecustomer (1,function () {
Alert ("CG"); Test
)
}
</script>

Second, explain
The normal methods used in the business logic class Customermanagerimpl.java will not be invoked by static pages, such as
Copy Code code as follows:

Public String test () {
return "Hello";
}

The following code could not be executed:
Copy Code code as follows:

Jcustomermanager.test (function (data) {
alert (data);}
)
Jcustomermanager.test (function (data) {
alert (data);}
)

The registration method required for new
Copy Code code as follows:

<dwr>
<allow>
<!--dwr+spring-->
<create creator= "new" javascript= "Jcustomermanager" >
<param name= "class" value= "... Xxx.customermanager "/>
</create>
</allow>
</dwr>
<dwr>
<allow>
<!--dwr+spring-->
<create creator= "new" javascript= "Jcustomermanager" >
<param name= "class" value= "... Xxx.customermanager "/>
</create>
</allow>
</dwr>

Three, need to use new and spring correctly, pay attention to the difference between the two

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.