| Author |
Something wrong with my application
|
Hui Ge
Greenhorn
Joined: Mar 11, 2005
Posts: 25
|
|
I came up with a simple app and have been facing problems. I deliberately created an SQLException so that the ErrorServlet will process it. I ran eclipse in debugging mode and the code runs untill the end of the doPost method and ends with a HTTP 500 error. Can someone tell me why this is happening? I would appreciate it if anyone could take a look at my war file. web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://localhost/dtd/web-app_2_3.dtd"> <web-app> <context-param> <param-name>driverClassName</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> <context-param> <param-name>dbUsername</param-name> <param-value>****</param-value> </context-param> <context-param> <param-name>dbPassword</param-name> <param-value>****</param-value> </context-param> <listener> <listener-class> MyListener </listener-class> </listener> <servlet> <servlet-name>ErrorServlet</servlet-name> <servlet-class>chapter04.ErrorServlet</servlet-class> </servlet> <servlet> <servlet-name>LoginServlet</servlet-name> <servlet-class>chapter04.LoginServlet</servlet-class> <init-param> <param-name>dburl</param-name> <param-value>jdbc:mysql://localhost/test</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/login</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ErrorServlet</servlet-name> <url-pattern>/error</url-pattern> </servlet-mapping> <error-page> <error-code>403</error-code> <location>/html/login.html</location> </error-page> <error-page> <exception-type>java.sql.SQLException</exception-type> <location>/error</location> </error-page> </web-app> ErrorServlet: package chapter04; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /* * Created on Mar 26, 2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author Me * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class ErrorServlet extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { doPost(req, res); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { } }
|
 |
 |
|
|
subject: Something wrong with my application
|
|
|