Atititjs JavaScript exception handling mechanism and Java exception conversion . JS Exception Process
1. javascriptexception handling mechanism
Throw Str
Not throw error: Cause IE,FF Error obj is diff:
2. Webunified processing of front and rear station anomalies
Not a Java exception into a JS exception to go ok ...
Author:: Old Wow's paw attilax Ayron, email:[email protected]
Reprint please indicate source: Http://blog.csdn.net/attilax
3. javathe exception is converted toJSException
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 event has not set a prize yo. "," StackTrace ": [{" ClassName ":" Com.focustar.servlet.AwardServlet "," FileName ":" Awardservlet.java "," linenumber ":" MethodName ":" Main "," Nativemethod ": false}]," suppressed ": []}
---JS
if (data. leftcount==null)
{
Showeoog (data);
return;
}
function Showeoog (data)
{
var o ={};
Alert (o["a"]);
// alert (o["a"]==null);//true
Alert (o["a"]== "");//false
// alert (data["@type"]);
if ( data [ " @type " ]!= NULL  &&  data " Span style= "color: #c0c0c0; Background:rgb (0,0,0) ">[ " @type " ]== " Java.lang.RuntimeException "
alert (data. message);
return;
}
}
Atititjs JavaScript exception handling mechanism and Java Exception conversion. JS Exception Process