How to Properly Handle Exceptions in a JSP/Servlet App?

前端 未结 4 1299
悲&欢浪女
悲&欢浪女 2020-11-28 14:09

How do you properly handle errors encountered in a servlet? Right now, the app that I inherited (uses only plain JSP/Servlet) has a superclass called Controller

4条回答
  •  心在旅途
    2020-11-28 14:12

    In JSP you can use jstl core library

    1) Import tablib on top of JSP file

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    

    2) use tag

    
        Code that might throw Exception
    
    
    
        There was an exception: ${myExceptionObject.message}
    
    

提交回复
热议问题