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