1. The use of finally:
public static int Geta () {
try{
String a = "123";
S.equals ("123");
return 3;
}catch (Exception e) {
return 4;
}finally{
Return 5;//no matter if the exception is not, finally must be executed
}
}
public static void Main (String args[]) {
int A=geta ();
Sysout (a);//a=5
}
2, MySQL garbled problem
Compared to Gbk,utf-8: The range is large, all recognize Chinese
3, development to layered (object-oriented)
Dao (persistence layer) Business Service Layer Control layer
4. servlet process
The display implements the service method, accesses the constructor first, and then Init is loaded once when the servlet is first used.
Servlet cannot do unit tests (servlet is intrusive design mode)
5. Why is struts thread-safe?
Servlet is non-thread safe: Single power, multithreaded mode
Struts: Multithreading, Multi-instance
6. Conceptual Model:
8.15
Process: Create VO entity object, write service layer->action->struts
8.16
404 error: File not found, Interceptor resolved, Interceptor is the core of Struts2
Iterator???
What is the problem in the iterative process??
Interceptors:
<!--configuring Interceptors--
<interceptors>
<!--configuring interceptors to handle encoding format problems--
<interceptor name= "encondinginterceptors" class= "Com.etc.interceptor.EncondingInterceptors" ></ Interceptor>
<!--Interceptor Stack (Interceptor collection)--
<interceptor-stack name= "Mydefaultstack" >
<!--reference your interceptor--
<interceptor-ref name= "Encondinginterceptors" ></interceptor-ref>
<interceptor-ref name= "Defaultstack" ></interceptor-ref>
</interceptor-stack>
</interceptors>
<!--Configure the STRUTS2 default Interceptor--
<default-interceptor-ref name= "Mydefaultstack" ></default-interceptor-ref>
To move an exception to the interface:
<!--global View--
<global-results>
<result name= "Error" >/error.jsp</result>
</global-results>
<!--exception Handling--
<global-exception-mappings>
<!--whenever java.lang.Exception occurs, jump to the error view--
<exception-mapping result= "error" exception= "Java.l ang. Exception "></exception-mapping>
</global-exception-mappings>
This article from "11944396" blog, declined reprint!
Finally, the interceptor is the core of the STRUTS2, exception handling