Struts json type exception returned to js bullet box solution, strutsjson
Solution to js pop-up box error returned by struts json type exception
When the struts framework is configured with an exception, for example:
<package name="sysCnn" namespace="/" extends="json-default"> <global-results> <result name="error">/WEB-INF/pages/error.jsp</result> <result name="over">/js/over.js</result> </global-results> <global-exception-mappings> <exception-mapping result="error" exception="java.lang.Exception" /> <exception-mapping result="over" exception="com.xxx.exception.OverException" /> </global-exception-mappings> <action name="ConnONGL_*" class="com.xxx.action.LoginAction" method="{1}"> <result name="success" type="json" > <param name="root">jsonMap</param> </result> </action>
When an action throws an exception, the ideal situation is to go to the exception information page or the js pop-up prompt, the error message page or pop-up prompt is displayed only on the console of the browser.
Modify the ajax request and comment out dataType: "Json". The js pop-up box will be displayed normally.
$. Ajax ({url: $. contextPath + "/ConnONGL_login", // dataType: "Json", comment out async: false, cache: false, data :{
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!