Exception Handling
1. runtime exception
A: 1) An error is returned when a program is running;
2) can be referenced by a fixed exception object;
3) You can create an exception reference or generate a JSP page to display the exception information to the user.
2. Create an exception tracking solution
Answer: 1) Each JSP page contains the name of the exception page to be created;
2) create an exception page;
3. Exception Handling on the JSP page
Answer: 1) print the Exception name;
2) print the list of all errors in the current error stream;
3) print the detailed description of the Error
More advanced topics
1. internally recognized objects in JSP
Answer: Name type comment and Range
Request javax. servlet. http. HttpServletRequest request
Response javax. servlet. http. HttpServletResponse response
PageContext javax. servlet. jsp. PageContext page
Session javax. servlet. http. HttpSession session
Application javax. servlet. ServletContext
Out javax. servlet. jsp. JspWriter output stream
Config javax. servlet. ServletConfig
Page javax. lang. Object page
Exception java. lang. Throwable page
2. request of default object)
A: The request from the client is encapsulated:
Method: 1) getCookies: Obtain the Cookie array;
2) getMethod: return the form of the request (GET/POST );
3) getParameterNames: returns the enumeration of object names in FORM;
4) getParameter: returns the object Value of the specified name;
5) getParametervalues: returns an array of object values with the specified name;
6) setAttribute: Set attributes;
7) getAttribute: returns the property value;
GetAttributeNames: returns the enumeration of attribute names.
3. out of default object
A: an instance of JSPWriter used to send a response to the client.
Method: 1) print (String)/println (String)
2) print (int)/println (int)
3) flush ()
4. exception of default object
Answer: 1) an exception instance is used for an exception object;
2) The error page contains the attribute isErrorPage = "true" in the page command ";
3) method: getMessage ()/printStackTrace ()/toString ()
5. Default object session
Answer: 1) an instance of HttpSession is used to maintain the status of a session.
2) method: getAttribute ()
SetAttribute ()
RemoveAttribute ()
GetAttributeNames ()
6. application of default object
Answer: 1) an instance of ServletContext is used to maintain the application state.
2) method: getAttribute ()
SetAttribute ()
GetInitParameter ()
GetServletInfo ()
3) The application has a much larger scope than the session. One session is associated with one client, while the application maintains the State for all clients.
- Several simple and effective methods for improving Jsp skills
- Seven Tips for improving JSP page response speed
- Seven Practical Methods for Improving JSP applications