It behaves exactly the same way as a normal listener method - the only difference being what causes it be invoked. So, in your example I'm not sure what would happen but probably an error of some kind.
If you want to update a component you can use ResponseBuilder (grabbed via IRequestCycle or hivemind autowired if you define a public abstract ResponseBuilder getResponseBuilder() property ) http://tapestry.apache.org/tapestry4.1/ajax/responsebuilder.html On 5/28/07, Janos Mucsi <[EMAIL PROTECTED]> wrote:
Hi Thanks, Jesse, for your answer. What if I want to return values from the listener method? Instead of @EventListener(elements = "myFavoriteDiv", events = "onmouseover") public void watchText(BrowserEvent event) { System.out.println("watch text entered"+event); } I want something like @EventListener(elements = "myFavoriteDiv", events = "onmouseover") public List<State> watchText(BrowserEvent event) { // get country id from event // String countryId = ...; List<State> states = someService.getStates(countryId); return states; } (Of course, probably it would be a <select> and onChange.) Is there a way to do this? Thanks. Janos Jesse Kuhnert wrote: > I'm not sure what you mean, the asynchronous portion should happen > automatically. > > It should also behave exactly the same way as your listener method > would if > it were say a @Submit component listener or @DirectLink listener. The > major > difference is that it automatically submits your form if you happen to be > targeting a component that implements IFormComponent. (which most form > based > Tapestry components do) > > http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html > > On 5/27/07, Janos Mucsi <[EMAIL PROTECTED]> wrote: >> >> Hi >> >> I am new to Tapestry, so excuse my basic question. I am reading >> http://tapestry.apache.org/tapestry4.1/tapestry-annotations/index.html >> >> and was wondering how @EventListener implements asynchronous calls. Does >> anybody have a sample that behaves like the example: >> >> @EventListener(events = "selectOption", targets = "projectChoose", >> submitForm = "taskForm", async=true) >> public void projectSelected(IRequestCycle cycle) >> { >> >> cycle.getResponseBuilder().updateComponent("projectDescription"); >> cycle.getResponseBuilder().updateComponent("feedbackBlock"); >> } >> >> >> Thanks! >> >> -- >> Janos Mucsi >> >> >> > > -- Janos Mucsi 209-346-4294
-- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com