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