BTW, digging into code and API docs, I read:

boolean
org.apache.tapestry5.runtime.Component.dispatchComponentEvent(ComponentEvent
event)

Invoked to handle a component event. Methods with the OnEvent annotation
(or the matching naming convention) will be invoked until one returns a
non-null value.

So I updated to code above to return a JSON object instead of null. But
still throwing the same error.




On Fri, Jun 20, 2014 at 11:03 PM, Sanket Sharma <sanketsha...@gmail.com>
wrote:

> 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
>
>
>
>
>
>

Reply via email to