Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
XT Ajax XT.doAjaxSubmit problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XT Ajax XT.doAjaxSubmit problem

    Hi

    I am having problems getting doAjaxSumit to work as I keep getting:

    UnsupportedEventException: Cannot handling the given event with id: loadBaseAssets

    I have successfully used XT.doAjaxAction in my app and everything is ok. I wanted to call an event handler after the form submission which in fact I had already called successfully by doAjaxAction. Its probably a configuration error, but I can't see it.

    Here is my code:

    Spring config:

    Code:
    <bean id="fxstrikeoptimizerController" class="com.barcap.fx.web.controller.FxStrikeOptimizerController">
            <property name="sessionForm"><value>true</value></property>
            <property name="commandName"><value>strikeOptimizeCommand</value></property>
            <property name="commandClass"><value>com.barcap.fx.bus.command.StrikeOptimizeCommand</value></property>
            <property name="validator"><ref bean="strikeOptimizeValidator"/></property>
            <property name="formView"><value>strike</value></property>
            <property name="successView"><value>ajax-redirect:/strike.do</value></property>
            <property name="cmd">
                <ref bean="strikeOptimizeCommandBean"/>
            </property>
            <property name="webservice">
                <ref bean="fXStrikeWebService"/>
            </property>
        </bean>
    
    <bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
        <property name="handlerMappings">
            <props>
                <prop key="/strike.do">ajaxStrikeHandler</prop>
            </props>
        </property>
    	</bean>
    My ajax handler class contains multiple handlers all of which work when called by a doAjaxAction, but when I try to call one of them with

    Code:
    XT.doAjaxSubmit('loadBaseAssets', this);

    I get the following exception

    Code:
    2007-07-06 12:47:42,472 INFO [org.springmodules.xt.ajax.AjaxInterceptor] - Post-handling ajax request for event: loadBaseAssets
    2007-07-06 12:47:42,472 ERROR [org.springmodules.xt.ajax.AjaxInterceptor] - Cannot handling the given event with id: loadBaseAssets
    org.springmodules.xt.ajax.support.UnsupportedEventException: Cannot handling the given event with id: loadBaseAssets
    	at org.springmodules.xt.ajax.AjaxInterceptor.postHandle(AjaxInterceptor.java:245)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:863)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    2007-07-06 12:47:42,488 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/FXStrikeOptimizer].[fxstrikeoptimizerapp]] - Servlet.service() for servlet fxstrikeoptimizerapp threw exception
    org.springmodules.xt.ajax.support.UnsupportedEventException: Cannot handling the given event with id: loadBaseAssets
    	at org.springmodules.xt.ajax.AjaxInterceptor.postHandle(AjaxInterceptor.java:245)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:863)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    Any help greatly appreciated

    thanks

    Steve

  • #2
    Originally posted by doyles View Post
    I am having problems getting doAjaxSumit to work as I keep getting:
    UnsupportedEventException: Cannot handling the given event with id: loadBaseAssets
    [CUT]
    Hi Steve,

    sorry for the late reply, I've been away.

    Please can you post your HTML/JSP code, plus your Ajax handler code (at least your methods signatures)?

    Thanks,
    Cheers,

    Sergio B.

    Comment


    • #3
      Re XT Ajax XT.doAjaxSubmit problem

      Hi Sergio,

      Thanks for coming back.

      Here is my handler code

      Code:
      public AjaxResponse loadBaseAssets(AjaxActionEvent event) {
      		
      		logger.info("loadBaseAssets- Start");
      						
      		String assetVal=(String)event.getParameters().get("asset");
      		logger.info("asset = "+assetVal);
      		
      		StrikeOptimizeCommand cmd=(StrikeOptimizeCommand)event.getCommandObject();
      		String baseAsset=cmd.getBaseCCY();
      		logger.info("base = "+baseAsset);
      				
      		// Create the component to render (a list of html option elements):
              List options = getBaseAssetOptions(assetVal,cmd);
              logger.info("new base = "+cmd.getBaseCCY());
              event.setCommandObject(cmd);
                             
              // Create an ajax action for replacing the content of the "baseAssets" element with the components just created: 
              ReplaceContentAction BaseAssetsAction = new ReplaceContentAction("baseAssetsId", options);
                          
              // Create a concrete ajax response:
              AjaxResponse response = new AjaxResponseImpl();
              // Add the actions:
              response.addAction(BaseAssetsAction);
                          
              logger.info("loadBaseAssets- end");
              return response;
      	}

      and JSP fragment:

      Code:
      <form:select path="baseCCY" id="baseAssetsId" 
      				      			onchange="XT.doAjaxAction('loadMarketSpot', this, {'asset':assetId.value,'base':baseAssetsId.value,'tenor':tenorId.value});"
      				      		 >
      				      		<form:option value="Please Select"/>
      				      		<form:option value="EUR"/>
      				      		<form:option value="GBP"/>
      				      		<form:option value="USD"/>
      				      		<form:option value="AUD"/>
      				      		<form:option value="CHF"/>
      				      		<form:option value="CAD"/>
      				      		<form:option value="JPY"/>
      				      	</form:select>
      cheers

      Steve

      Comment


      • #4
        forgot here is the submit code


        function submitStrikeForm()
        {
        //document.strikeForm.submit();
        var selectedAsset=document.getElementById("assetId");
        XT.doAjaxSubmit('loadBaseAssets', this, {'asset':selectedAsset.value});
        }

        Comment


        • #5
          Originally posted by doyles View Post
          Here is my handler code
          Code:
          public AjaxResponse loadBaseAssets(AjaxActionEvent event) {
          [CUT]
          It has to be:

          Code:
          public AjaxResponse loadBaseAssets(AjaxSubmitEvent event) {
          Methods handling submit events must have an AjaxSubmitEvent parameter.

          Let me know.
          Cheers,

          Sergio B.

          Comment


          • #6
            doh !

            Its always the silly ones that get me

            Thanks Sergio

            Comment


            • #7
              My application is using spring MVC + Spring Webflow and in that case when i am going to reder a flow which is using ajax the application timeout occurs and i am handling the exception occured during timeout in flow handler . During this exception i am trying to redirect the flow to the default flow within Abstractflow handler using the following code.
              public String handleException(FlowException flowException, HttpServletRequest request, HttpServletResponse response) {
              Exception exception = (Exception)findRootCause(flowException.getCause()) ;
              String errorCode = null;
              if (flowException instanceof NoSuchFlowExecutionException) {
              BookingException bookingException=new BookingException(flowException);
              bookingException.setErrorCode("flow.invalid");
              request.setAttribute(WebKeys.BUSINESS_ERROR,bookin gException );
              if(request.getRemoteUser()!=null){
              request.getSession().invalidate();
              return "/ibe/login";
              }else{
              request.getSession().invalidate();
              return "/ibe/booking";
              }

              In the normal flow it gets redirected to the given url but in the case of ajax flow its adding &fragments"somename" to the redirected URL so the url becomes "/ibe/login&fragments omename". Why this is happening.

              Due to this issue i am not able to render a viw while application timeout occurs in ajax flow.

              Comment

              Working...
              X