问题
I worked with Struts 2.0.11 and Struts 2.1.6 and have no problem with the s:submit or sx:submit with "targets" attribute. While upgrading our project from Struts 2.0.11 to 2.3.16, I have the following problem:
<head>
<sx:head parseContent="true"/>
</head>
<s:form action="report_accumulatedResult" cssStyle="font-size :8pt; font-family: verdana" method="post" validate="true" >
<s:textfield name="startDate" label="Start Date" size="15" cssClass="datepicker" />
<s:textfield name="endDate" label="End Date" size="15" cssClass="datepicker" />
<sx:submit align="center" targets="report_result" showLoadingText="false" indicator="loadingImage"/>
</s:form>
<img id="loadingImage" src="images/activityBarRefresh.gif" style="display:none" />
<s:div id="report_result" >
<%@ include file="/pages/incentive/reports/accumulatedResult.jsp" %>
</s:div>
In XML, I have something like:
<result name="ajax-result">/pages/incentive/reports/accumulatedResult.jsp</result>
Every time I submit the form, instead of showing my page in the div with id="report_result", the result page just appears occupying the whole page. It looks like the targets attribute is not working as expected. Does anyone has similar issue and any solution? Thanks.
来源:https://stackoverflow.com/questions/23481243/struts-2-3-16-sxsubmit-targets-not-working-as-expected