Atitit. dwr3 solution where error details cannot be displayed. Solution for displaying error details by controls java. net php, atitit.dwr3.net
Atitit. dwr3 solution where error details cannot be displayed. Solution for displaying error details by controls java. net php
1. Keyword/subtitle 1
2. Abnormal convert Processing Using dwr3 cannot be lifted. According to the stolen base, it can be solved... 1
3. Use the js callback function for processing... or not. The child can display a. javaClassName: "java. lang. Throwable", message: "Error"} 2
4. Exception converter 2
5. Of course, if you want to only Time Out/warn/handle an error for a function, you can also perform 4
6. Custom Exception Handling System: 4
6.1. Exception capture 4
6.2. Exception display 4
6.3. How to solve the problem that Alert cannot display full format exception information: Custom page display 5
6.4. htmlEncode Issue 6
7. Refer to 6
1. Keyword/subtitle
Control Display Error details Solution
Control debugging Solution
Team building-Technical Building-debugging method
2. Abnormal convert Processing Using dwr3 cannot be lifted. It can be removed by hacking ....
<Convert match = "java. lang. Exception" converter = "exception">
<Param name = "include" value = "message"/>
</Convert>
<! -- Make sure to configure the following items. Otherwise, the following error will be reported: org. directwebremoting. util. CommonsLoggingOutput error is critical: No converter found for 'java. lang. StackTraceElement '-->
<Convert match = "java. lang. StackTraceElement" converter = "bean"> </convert>
The custom exception is displayed. The default exception of 10 cannot be ....
Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://blog.csdn.net/attilax
3. Use the js callback function for processing... or not. The child can display a. javaClassName: "java. lang. Throwable", message: "Error "}
// DWREngine. setErrorHandler (ehO9); jei haosyo dwr2d
Function errh (errorString, exception ){
// Alert (errorString );
// Alert (JSON. stringify (exception ));
Eval (dwrxO9). getErr (function (data ){
Alert (data );
Window. open ("<% = path %>/com. attilax/util/dwrerr. jsp ");
});
}
Dwr. engine. setErrorHandler (errh );
4. Exception Converter
\
When writing business logic on the server side, we usually use try {} catch {} to catch exceptions, if some exceptions occur in the background, how can we display them on the foreground? Here, dwr provides us with an Exception converter ), however, if this type of converter is not displayed, it will provide us with an error exception by default, and the exception reported in the background will be displayed to us in the foreground as an error, however, the detailed information is not exposed, so we need to configure the error converter and display the exception information. Example:
Common Methods in engine. js include:
DWREngine. setErrorHandler (function) handle errors
DWREngine. setWarningHandler (function) handle warnings
DWREngine. setTimeout () sets the timeout time.
DWREngine. setAsync (false); Set DWR to synchronous call
DWREngine. setAsync (true); Sets DWR to asynchronous call
Run the call to print an Error. It is specified by the dwr framework. If an exception occurs during access to the background, the front-end prompts for us as Error, the common exceptions are displayed as errors.
If we do not want an Error, we want to know which exception the front-end reports to us is for the background. We need this exception converter to specify the conversion of this exception, capture the exception information to the front-end, and print it out on the front-end. We need to use the built-in converter provided by dwr in dwr. configuration in xml:
<Convert match = "com. ryanlu. exception. FunkyException" converter = "exception">
<Param name = "include" value = "message"/>
</Convert>
If the exception handling converter is configured and an exception occurs in the background, the foreground can print it out. running result: "exception details, date = Mon Jan 01 2008 10:00:00 GMT + 0100 ". This means that by configuring the exception handling converter, you can capture exceptions in the background at the front end and provide detailed exception information.
Because "A" in Ajax refers to asynchronous (asynchronous), every Demo. Method execution is asynchronous.
If you want to specify global timeout settings, you can use DWREngine. setTimeout () to complete
Similarly, DWREngine. setErrorHandler (function), DWREngine. setWarningHandler (function)
Used to set global error and warning handling
5. Of course, if you want to only Time Out/warn/handle errors for a function, you can also
As follows:
Demo. method (params ,{
Callback: function (data) {alert ("it worked ");},
ErrorHandler: function (message) {alert ("it broke ");},
Timeout: 1000
});
Note: callback and errorHandler are variables in engine. js. Used to handle exceptions. The advantage of writing this is that the callback function will be called if normal execution occurs, and the exceptionHander function will be called if an exception occurs. Note that callback and errorHandler must be written in the preceding method, which is specified in engine. js.
6. Custom Exception Handling System ::
Thinki: no exception capture. Put a session blackhead. Call it using dwr...
6.1. Exception capture
3. Custom excators cannot be used. It seems that the dwr filter is called first, and there is no exception. The transient excator is abnormal... I want to get a call method. naner Jia Lei captures the data...
6.2. Exception display
Store ex
@ RemoteMethod public void save_map (Map mp ){
Try {
This. basesvs. save_map (mp );
} Catch (Exception e ){
DwrX. getSession (). setAttribute ("errO9", core. getTrace (e ));
Throw new RuntimeException ("-- oa1c:" + e. getMessage (), e );
}
}
-------- Show ex
}
// DWREngine. setErrorHandler (ehO9); jei haosyo dwr2d
Function errh (errorString, exception ){
// Alert (errorString );
// Alert (JSON. stringify (exception ));
Eval (dwrxO9). getErr (function (data ){
Alert (data );
Window. open ("<% = path %>/com. attilax/util/dwrerr. jsp ");
});
}
Dwr. engine. setErrorHandler (errh );
6.3. Alert cannot display full format exception information. Solution: display on custom page
Window. open ("<% = path %>/com. attilax/util/dwrerr. jsp ");
<% = Core.txt 2 html (request. getSession (). getAttribute ("errO9") %>
6.4. htmlEncode Problems
Public static String txt2html (Object s2 ){
// Attilax old wow's paw 2_r_1 o03
String s = StringEscapeUtils. escapeHtml4 (s2.toString ());
S = s. toString (). replaceAll ("\ r \ n", "<br> \ r \ n ");
S = s. toString (). replaceAll ("","");
S = s. toString (). replaceAll ("\ t ","");
Return s;
}
7. Reference
DWR Exception Handling-RyanLuX's column-blog channel-CSDN.NET.htm
The activex Control prompts you to install the control. After clicking OK, the control cannot run and no error is displayed on the page.
Open IE browser tool INternet option Security Custom Level for activex control not marked as secure ...... select enable
The VB loading error log shows that the jbxxsz control cannot be loaded (the first main menu). The control contained is not a valid carrier.
Is to press the Z key to enable every 15 seconds to press a button on the web page (for voting), press the X key → professional easy language technical exchange learning platform
0
| Comment