Atitit.js JavaScript exception handling mechanism and Java Exception conversion. JS Exception Process Voae

Source: Internet
Author: User

Atitit . JS JavaScript exception handling mechanism and Java exception conversion . JS Exception Process Voae

1.1. JavaScript exception handling mechanism 1

2.2. Unified processing of web-front and back-table exceptions 1

3. Java Exception conversion to JS exception 1

3.------------- Detail Code 2

1.1. JavaScript exception handling mechanism

Throw Str

Not throw error: Cause IE,FF Error obj is diff:

2.2. Unified processing of web-front and back-table anomalies

Not a Java exception into a JS exception to go OK ...

Dwr saw the exception conversion of dwr , three , does not take effect ... had to output Str to convert ...

Author :: Old Wow's paw attilax ayron, email:[email protected]

Reprint please indicate source: Http://blog.csdn.net/attilax

3. Java Exception conversion to JS exception

Elmtc.filechangeevent ($ ("#filePath"). Val (), Function (data)

{

PROCESSJAVAEX (data);

var plt_s=secs2str (data. Duration);

$ (' #playtime '). Timespinner (' SetValue ', plt_s);

});

3.-------------Detailed Code

if (nosetawd(ActivityID)) {

runtimeexception E=new runtimeexception("E:nosetawderr This activity has not set a prize yo ." ) );

String s = jsonobject. toJSONString(e);

Return s;

}

  

//{"@type": "Java.lang.RuntimeException", "Localizedmessage": "E:nosetawderr This activity has not set a prize yo ." , "message": "E:nosetawderr This activity has not set a prize yo .", "StackTrace": [{"ClassName": " Com.focustar.servlet.AwardServlet "," FileName ":" Awardservlet.java "," linenumber ":" MethodName ":" Main "," Nativemethod ": false}", "suppressed": []}

function LOGX (msg) {

try {

Console.info ("----------from LOGX");

Console.info ("--" +msg);

} catch (e) {

Not support Console method (Ex:ie)

}

}

function Processjavaex (data)

{

if (typeof data== "string")

data = eval ("(" + Data + ")");

if (data["@type"]!=null && data["@type"]== "Java.lang.RuntimeException")

{

if (data.message!=null)

LOGX (data.message);

throw data.message;

}

if (data["StackTrace"]!=null)

{

if (data.message!=null)

LOGX (data.message);

throw data.message;

}

Else

return false;

}

Reference

Atititjs JavaScript exception handling mechanism and Java exception conversion . js exception process-attilax column -  Blog Channel -CSDN.NET.htm

Atitit.js JavaScript exception handling mechanism and Java Exception conversion. JS Exception Process Voae

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.