Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

AJAX and Mixin events

$
0
0
Hi,

I am trying to create a mixin for geocoding user input and displaying it
on a map.

As suggested in previous questions in the forum, I implemented a mixin.

In my template (listing/AddListing.tml) I have:

<t:textfield t:id="addressLineOne" t:mixins="OpenStreetMaps"/>

In my component class, I have:

Object onGeocodeAddressFromAddressLineOne(String input) {
// Need to return JSON here
logger.debug("********* returning JSON data******");
logger.debug("*********Input recevied as*********" + input);
return null;

and in my mixin class I have:

private static final String GEOCODE_REQUEST_EVENT = "geocodeAddress";
Link eventLink = resources.createEventLink(GEOCODE_REQUEST_EVENT);

And there is some javascript that waits for "change" event on the text
fields and fires an AJAX request.
Now, everything seems to be working - when I enter text in the field, It
triggers the AJAX request.
However, the AJAX request fails with HTTP 500 (internal server error) and I
picked up following the logs:

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
with uncaught exception:
org.apache.tapestry5.ioc.internal.OperationException: Request event
'geocodeaddress' (on component listing/Add:addresslineone) was not handled;
you must provide a matching event handler method in the component or in one
of its containers. [at
classpath:com/dukstra/travelnet/web/pages/listing/AddListing.tml, line 31]
org.apache.tapestry5.ioc.internal.OperationException: Request event
'geocodeaddress' (on component listing/Add:addresslineone) was not handled;
you must provide a matching event handler method in the component or in one
of its containers. [at
classpath:com/dukstra/travelnet/web/pages/listing/AddListing.tml, line 31]

I tried adding the @OnEvent(value="geocodeaddress" and
component="addressLineOne") to the event handle above, but its still
failing.

Can't seem to figure out whats wrong? Would appreciate any help.

Best Regards,
Sanket

Viewing all articles
Browse latest Browse all 5648

Trending Articles