Announcement Announcement Module
Collapse
No announcement yet.
Duplicate parameters with Spring.remoting.submitForm results in ClassCastException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Duplicate parameters with Spring.remoting.submitForm results in ClassCastException

    Using Spring.remoting.submitForm with a partial page refresh, duplicate parameters appear in the second and subsequent requests. The first request is fine.

    The error manifests as a ClassCastException because the _eventId is duplicated resulting in an array returned from WebUtils.findParameterValue().

    If I switch the form method from getto post it does work. (I need to use get because of other issues...)

    Any ideas? is this a known issue? workarounds? Thanks in advance,

    First request's parameters:

    Code:
    eventId        refresh
    ajaxSource	refreshButton
    execution	e2s1
    fragments	status
    Second request's parameters (after fragment is refreshed):

    Code:
    _eventId       refresh
    _eventId	refresh
    ajaxSource	refreshButton
    ajaxSource	refreshButton
    execution	e1s1
    fragments	status
    fragments	status
    The exception:
    Code:
    Caused by: java.lang.ClassCastException: [Ljava.lang.String; incompatible with java.lang.String
    	at org.springframework.web.util.WebUtils.findParameterValue(WebUtils.java:565)
    The JSP/Tile:
    Code:
    <div id="status"> 
        <form:form id="refreshForm" method="get">
            <button id="refreshButton" style="float:right">
               <img src="<core:url value="/resources/images/refresh.gif"/>"/> 
            </button>
    ...
        </form:form>
    </div>
    Spring.addDecoration(new Spring.ElementDecoration({
        elementId 	: "refreshButton",
        widgetType 	: "dijit.form.Button",
        widgetAttrs : {
    	onClick : function() {
                Spring.remoting.submitForm(
                    'refreshButton', 
                    'refreshForm', 
                     {_eventId: 'refresh', fragments:'status'}
                 ); 
                return false;
            }
        }
    }));
    The web flow:
    Code:
    	<view-state id="page">
     		<transition on="refresh">
     			<evaluate expression="refresh"/> 
    			<render fragments="status" />
    		</transition>
    ...
    	</view-state>

  • #2
    I hardcoded the action and this solved the problem of the duplicate params...

    Code:
    <form:form id="refreshForm" method="get" action="${flowExecutionUrl}">

    Comment

    Working...
    X