Results 1 to 4 of 4

Thread: XT-Ajax: doAjaxAction - ServerParameters not working

Threaded View

  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Default XT-Ajax: doAjaxAction - ServerParameters not working

    Hi,

    I'm trying to pass some JSON object as a parameter by an Ajax Action Event to the server.

    Without any parameters (null) the event works perfectly and does what its supposed to do.

    But when I put some JSON object as "server-parameters" there is not response to the click at all.

    This is the definition of the doAjaxAction method in the manual.

    onclick="XT.doAjaxAction(event-id, source-element, server-parameters, client-parameters);"

    The following line works perfectly
    Code:
    <form name="" action="">
    <input id="testEvent" type="button" value="Press" onclick="XT.doAjaxAction('testEventAction', this,);">
    <div id="content"></div>
    </form>
    This one doesn't do anything. There is no reaction to that onlick event at all
    Code:
    <form name="" action="">
    <input id="testEvent" type="button" value="Press" onclick="XT.doAjaxAction('testEventAction', this, {'testparam' : 'TESTVALUE'},null);">
    <div id="content"></div>
    </form>
    The is the Action Handler
    Code:
    public class TestActionsHandler extends AbstractAjaxHandler {
      public AjaxResponse testEventAction(AjaxActionEvent event) {
            // doing here something with the parameter Value via event.getParameters().get("testparam")
        	AppendContentAction action = new AppendContentAction("content", new SimpleText("test"));
            AjaxResponse response = new AjaxResponseImpl();
            response.addAction(action);
            return response;
        }
    }
    the servlet.xml
    Code:
    <!-- Ajax Interceptor -->
    <bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
      <property name="handlerMappings">
        <props>
          <prop key="/preview.*">ajaxTestActionsHandler</prop>
        </props>
      </property>
    </bean>
    		
    <!-- Ajax Handling -->
    <bean id="ajaxTestActionsHandler" class="ajax.TestActionsHandler"/>
    can anybody tell me why that event doesn't fire when i wanna pass some JSON parameters to the server.

    Thanks in advance



    UPDATE:

    There is a response. I traced the call and there seams to be a problem within the AjaxInterceptor. Within the initEvent method the JSONObject never returns. The code just stops at the last line of the following snippet. I tried to look into JSON itself but didn't find anything there.
    (The paramsString is a valid JSON Object)

    Code:
     
    private void initEvent(AjaxEvent event, HttpServletRequest request) {
      String paramsString = request.getParameter(this.jsonParamsParameter);
      if (paramsString != null) {
        Map<String, String> parameters = new HashMap<String, String>();
        JSONObject json = JSONObject.fromString(paramsString);
    ANY contribution is appreciated.

    Thank you
    Last edited by NJansen; Aug 22nd, 2008 at 07:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •