Today, instructor Liang Yanbing explained ajax to everyone. He first introduced the applications of Web 2.0 and Web 2.0.
Ajax framework:
Client framework: dojo, bindows, Rico
Server framework: DWR, JSON, Buffalo
Basic Library: Prototype. js
This is the buffalo framework. To register a bean object through a registration file, the configuration item in the buffalo configuration file is "object instance name = fully qualified class name ".
ClientCode:
VaR end_point = "<% = request. getcontextpath () %>/bfapp ";
VaR buffalo = new Buffalo (end_point );
Buffalo. remotecall ("userservice. login", ["username", "password"], function (reply ){
VaR success = reply. getresult ();
If (SUCCESS ){
Alert ("You login successfully ");
} Else {
Alert ("User Name or password incorrect! ");
}
});
Check whether the buffan in the background of buffalo is shared. Use a counter to test whether a bean instance object is created for each request.
How is the request format sent from the client to the server? I arranged for Feng Weili to listen to it with the sniffer listening software.
I used to learn Java Web filters.ProgramYou can use filter to test the request and response information of buffalo.
If you intentionally change the value of the end_point of Buffalo, you can see that the request URL cannot be found. From this error, you can see the request URL of buffalo.
This is an error reported by Tomcat. Buffalo provides its own error display window.
Pay attention to the order of introduction when introducing buffalo. js files, because Javascript is interpreted in order.
Myeclipse Web browser can debug JavaScript and view HTTP protocol information.
Habit: create a resource directory to manage your own resource files.
Put the common directory on the public page, such as the error handling page
Place images.
Admin place the hypervisor.
Scripts specially places JS scripts
You can also use the script directory to store SQL scripts in the project.
Styles is used to place CSS files.
Use the WST plug-in to develop Java Web applications. The web distribution directory is in the project -->. metadata -->. plugin --> .. server. core... --> In the tmp directory, this plug-in often has problems. Some jar packages under lib cannot be copied to the distribution directory, and JSP files cannot be updated to the distribution directory.
Search for "event. Observe" in Baidu"
$ Implemented in prototype. JS is document. getelementbyid
The requirements and design ideas of ajaxtable
The JavaScript Object generated by the formtobean method of buffalo must contain the formbean object corresponding to the server. After receiving the object parameters of the client, Buffalo automatically calls the bean method of the registered server, and generates the object of the server as the parameter and passes it to the bean method. If the JavaScript Object generated by formbean contains only some of the Bo attributes, You can dynamically add other attributes to the JavaScript Object. For example, the form in ajaxtable does not contain the currently displayed page number. You can add it dynamically.