Hi there,
I am new to struts and am in process of learning. I am
running into trouble in the way an exception needs to
be handled in Struts, I tried to do the traditional
Jsp way, using the error page tag in the "page"
directive and after looking into the mailing list, I
made changes into the web.xml and included the
following,
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/error.jsp</location>
</error-page>
But am not getting the exception message am always
getting a default nullpointer as a message in my error
jsp instead of the actual message as well when i look
into the console i get a runtime failure in custom tag
form/html instead of the actual message thrown, These
are my test jsp's and the entry in web.xml is given
above, could someone help me in fixing this up.
Thanks
VeeRa
The code for the testing the exception "TestExcep.jsp"
<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld"
prefix="html" %>
<html:html locale="true">
<head>
<title>Exception Test</title>
</head>
<body>
<html:form action="/samepage">
<%
String a = "asd";
try
{
System.out.println("The Integer Value is
"+Integer.parseInt(a));
}
catch(Exception e)
{
System.out.println("Exception is "+e);
throw new ServletException("Exception ",e); }
%>
<html:submit value="submit" />
</html:form>
</body>
</html:html>
and the code for the error.jsp
<%@ page isErrorPage="true"%>
<%
System.out.println("Exception "+exception);
%>
<HTML>
<HEAD>
<TITLE>Exception Page</TITLE>
</HEAD>
<BODY BGCOLOR='#FFFFFF' TEXT='#000000' LINK='#000066'
ALINK='#FF0000' VLINK='#000066' MARGINWIDTH='0'
MARGINHEIGHT='0' LEFTMARGIN='0' TOPMARGIN='0'>
<p> </p>
<P ALIGN='CENTER'><FONT COLOR='blue' FACE='Book
Antiqua'><%=exception.getMessage()%></FONT></P>
<p> </p>
</BODY>
</HTML>
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>