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.