Martin Marinschek wrote:

Interesting server-name ;)

To understand you correctly - the AJAX request is used to build up the
faces tree anew, or is there just the servlet which does something in
the backend without being in the faces-context?



The calling order goes like that:
xmlhttprequest object on the client calls the server asynchronously with some data -> generic ajax controller servlet ->ajax event handler building up the xml from whatever datasource -> xml back to servlet -> servlet sending it back to the client -> client does something with the xml after getting the results back.

The incoming data has to follow a certain syntax, the event handler has
to build up the tree so that the client can do something with it.
The servlet itself tries to identify which event is coming in
and maps the event to the correct event handler class, if possible.

Theoretically the servlet could be exchanged by a phase listener class, like Norbye the original implementor of the classes did it. But at the implementation time I was not to familiar with the phase listeners so I stayed with the servlet binding.

The main thing is, that I used the generic naming scheme for the event handling, once you have the controller servlet up and running the event handlers are identified by their names and associated to the incoming request. The association is done via the registering of the backend bean in the faces-config.xml (I dont have the exact syntax handy currently, but it is something like

<bean-name>ajaxEvent_eventname<bean-name>
A system which also jakarta turbine and jetspeed use for their page events where the binding of the events to the methods happen without glue file.

The main problem is, there is no real totally easy way for the association between frontend and backend currently, I could think of,
where I could bypass the config file at all. So staying in the
faces-config context and not introducing yet another huge syntax and trying to bind it over events seems sort of natural.

Either you go through the full servlet route and write a servlet for every case you can think of and end up with a huge and messay web.xml or you go the the Phaselistener route like the guy from Sun did it in his original example, or you try to find a half generic middle way.

I am not perfectly happy with the backend handleEvent interface yet either, I think I will encapsule the incoming data into a AjaxEvent
class, which also feels more natural than having to pass 3-4 params)

Reply via email to