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
Handlers and Interceptor execution order Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handlers and Interceptor execution order

    Hi World,

    I'm having a problem with an application using Spring 2.5.4 + Spring MVC + Spring XT Interceptor.

    I've a button adding an object in my model through an AjaxHandler, using Spring XT. Then the updatePublList() method is calling the Spring MVC controller to enable the publiList.jsp to iterate on the new collection and to be integrated in the DIV where the table is displayed.

    The first time I'm pressing the button, nothing's happening but using logs I'm getting this:
    DEBUG AjaxListingController - Ajax listing request handled
    DEBUG AjaxHandler - ## PUBLICATION ADDED ##


    And then the next times I'm pressing the button, I'm getting:
    DEBUG AjaxHandler - ## PUBLICATION ADDED ##
    DEBUG AjaxListingController - Ajax listing request handled


    So, only at the first time, the Handler is called AFTER the controler. So the behavior is, first time nothings appearing, on the next pressure, two ellements appear, and on further preasure it's working fine.
    I discovered it's happening only once on each application restart. I'm using these mapping for more pages, and this behaviour is happenning only on the first try on any of those pages. Once a button has been pressed, it's working fine on any other page.

    Here are my source samples that should help to find the problem.
    Thanks for help.

    On the main JSP:
    Code:
    <script type="text/javascript" language="javascript" charset="utf-8">
    	function updatePublList(){
    		var response = sendRequest("publi/publiList.htm");
    		var el = document.getElementById('publlist');
    		el.innerHTML=response;
    	}
    </script>
    
    ...
    
    <div id="publlist">
    	<jsp:include page="publiList.jsp"></jsp:include>
    </div>
    		
    <input type="button" value="Add a publication" onclick="XT.doAjaxAction('addPubli', this, {'str' : this.value}); updatePublList()">
    publiList.jsp
    Code:
    <c:forEach items="${PubliFormTmp.publications}" var="publ">
    ...
    </c:forEach>
    Spring Configuration:
    Code:
    <bean id="ajaxHandler" class="org.mycompany.web.ajax.AjaxHandler" />
    
    <bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
    	<property name="handlerMappings">
    		<props>
    			<prop key="/*.htm">ajaxHandler</prop>			
    		</props>
    	</property>
    </bean>
    
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" autowire="no">
    	<property name="interceptors">
    		<list>
    			<ref bean="ajaxInterceptor" />
    		</list>
    	</property>
    	
    	<property name="mappings">
    		<props>			
    			<prop key="/publi.htm">/publi/publi.htm</prop>
    			<prop key="/publi/publiList.htm">/publi/publiList.htm</prop>
    		</props>
    	</property>
    </bean>
    
    <bean name="/publi/publiList.htm" class="org.mycompany.web.controlers.AjaxListingController">
    	<property name="view" value="publi/publiList" />
    </bean>
    
    <bean name="/publi/publi.htm" class="org.mycompany.web.controlers.PubliFormController" autowire="byName">
    	<property name="sessionForm" value="true" />
    	<property name="commandName" value="PubliForm" />
    	<property name="commandClass" value="org.mycompany.web.form.PubliForm" />
    	<property name="formView" value="publi/publi" />
    	<property name="successView" value="litho.htm" />
    </bean>
Working...
X