Title: RE: Why I can't find my file in servlet?

Hi Edward,

b'coze your data file is not in the correct location. better check ur PreReadError file is reading file from disk or not. if itz reading and not getting values itz is puzzle.. but it never happen ... some permission problem.

Hope it works if ur stream file is in server root directory.

cheers,
venu

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Edward

Sent: Friday, May 17, 2002 3:59 AM
To: [EMAIL PROTECTED]
Subject: Why I can't find my file in servlet?
Importance: High


I have a question,it is very puzzle to me.I have a class named PreReadError,it works well,it can read data from the file "error.data".For example:

...
 public static void main()
{
  String str;
  PreReadError test=new PreReadError();
  str=(String )test.getTable("Error0");
  System.out.println("Found Error0");
  System.out.println("It's value is "+str);
  ...
 }

When I run it,it will show:
  Found Error0
  It's value is 3

But when I use this class "PreReadError" in a servlet,for example:

...
public class GetUserIdentity extends HttpServlet
{
  public void doPost(HttpServletRequest request,HttpServletResponse response)
     throws ServletException,IOException
 {
    PreReadError test=new PreReadError();
    PrintWriter out=response.getWriter();
    out.println("<html>");
    out.println("<body>");
    String str=(String )test.getTable("Error0");
    out.println("<p> It's value is "+str+"</p>");
    ....
 }

Then I use deploytool which contained by j2sdkee1.3.1,I use it to deploy my class GetUserIdentity
When I run it,it should show:
  It's value is 3
But it shows:
  It's value is null

Why?
I'm very puzzled with it.
Any idea will be appreciated!
Thanks in advances!
Edward

___________________________________________________________________________
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