Hi,

This is really easy with jsp. I'm doing something similar. I don't have the code here, 
but
it goes something like:

in servlet.java:

HttpRequest req; // this is passed to you
HttpSession sess = req.getSession();
sess.setAttribute( "errorMessage", "Something terrible has happened." );

And I have this code in a file called header.jsp, which is included by other pages.
It uses the Standard Tag Library:
<jsp:useBean id="errorMessage" scope="session" class="java.jang.String"/>

<c:if test="${errorMessage.length == 0}">
    <c:out value="${errorMessage}"/>
</c:if>

Good luck,
Michael
Toronto

On Mar 16, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> 
> So... From a plain-old Servlet, when, for example, I'm retrieving text
> from a database and trying to create a PDF, and there is no text, how do
> I show a nice error page?
> 
> It's been a LONG time since I've done a regular Servlet.  Am I trying to
> apply some Struts-type global forward idea here without realizing it?
> Or is this supposed to work, except that in this case IE is "helpfully"
> refusing to show my page?
> 
> What I'm currently doing:
> [in PDFServlet.java]
> throw new ServletException( "No data found in HOLD file" );
> 
> [in web.xml]
> <error-page>
>    <exception-type>javax.servlet.ServletException</exception-type>
>    <location>/error.jsp</location>
> </error-page>
> 
> Should I instead be doing something with RequestDispatcher and
> forwarding to this JSP to avoid the status being set to 500 and
> confusing IE?
> 
> -- 
> Wendy Smoak
> Application Systems Analyst, Sr.
> ASU IA Information Resources Management 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to