Integration implementation code of dwr spring

Source: Internet
Author: User

I. Correct Use of spring
1. configuration of dwr. xml
Copy codeThe Code is as follows:
<Dwr>
<Allow>
<! -- Dwr + spring -->
<Create creator = "spring" javascript = "JCustomerManager">
<Param name = "beanName" value = "customerManager"/>
</Create>
</Allow>
</Dwr>

CustomerManager is the Id registered by spring.
2. Page call
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Function manager (){
JCustomerManager. deleteCustomer (1, function (){
Alert ("cg");} // Test
)
}
</Script>

Ii. Description
If the regular method used in the business logic class customerManagerImpl. java is not called by the static page, as shown in
Copy codeThe Code is as follows:
Public String test (){
Return "hello ";
}

The following code cannot be executed:
Copy codeThe Code is as follows:
JCustomerManager. test (function (data ){
Alert (data );}
)
JCustomerManager. test (function (data ){
Alert (data );}
)

New registration method is required
Copy codeThe Code is 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>

3. 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.