Provide a toString() method.

Regards
Slavikos

 ################################################################
   Filippos Slavik
   Part of the SIAMS's implementation development team. For more
   information, please check http://www.siams.net

   e-mail : [EMAIL PROTECTED]

 ################################################################

 "The software said 'runs on Win95 or better,' so I installed
  it on Linux..."


----- Original Message -----
From: Java List <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 17, 1999 10:33 PM
Subject: Error Handeling Methods


> I've written two static methods for handeling errors in my Servlets.  The
> return value is a PrintWriter object which contains the errors formattted
> in an HTML page.  One of the methods takes  a single (String) error as
> it's arguement, and the other takes multiple errors (Vector) as its
> arguement.  When I try to print this returned PrintWriter object in my
> Servlet, I'm getting a hash code rather than a String -   ( i.e.
> java.io.PrintWriter@b44b5d6f)
>
> Any Suggestions???
>
> -Nash
>
>
> Here's one of the  error handeling method:
> ---------
>         public static String getMultipleErrorsAsString(Vector error)  {
>
>                 PrintWriter writer = new PrintWriter(System.out);
>                 Header errorHead = new Header("Error");
>                 Body errorBody = new Body("#FFFFFF");
>                 writer.println(errorHead.printBasicHeader());
>                 writer.println(errorBody.printBasicBody());
>                 for (Enumeration e = error.elements();
e.hasMoreElements();)  {
>                         writer.println(e.nextElement().toString());
>                 }
>                 writer.println("</body></html>");
>
>                 return writer.toString();  //  <-- Why does this return a
hash code
> rather than a String?
>         }
> ---------
>
>
>
> And the line of code that calls the method from the Servlet:
> ------------
> out.print(Global.getMultipleErrorsAsString(global.SQLerrors));
> ------------
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to