Struts json type exception returned to js bullet box solution, strutsjson

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.