# re: 正本清源:所谓Ajax输出的三种形式 回复 更多评论
2005-12-30 23:19 by Vinson
Buffolo did a great job to provide an Ajax Engine, it is something like DWR, even though the implemenation is different.
In a real application, due to the maintainablity of the javascript, the less javascript, the better.
So it is better to assemble/validate the object in the serverside,while javascript only need to collect the data just into a map. and this can be generic.
Regarding the callback function, it can also be generic, the tasks that a callback function usualy like these.
. update field values.
. add/remove a dom node.
. update the html fragment.
. display errors/message.
.change stylecss.
. ...
you call it a callback engine. I think buffalo need to add this feature.
So there is no need to use JSON or xml, just keep the data in its original form, a Map of string, and then process them in the server side, it will make life
easier.
And the server side only need to return a collection of commands, the call back engine will know how to do it.
Java is more controllable than javascript. If anything can be done either in javascript, or in Java, Just do it with JAVA.