do something like this.Override the servlet's service method..... just try
to check if this will work, i really didn't test this.
public void service(HttpServletRequest request, HttpServletResponse
respo
nse) throws ServletException, IOException
{
ServletOutputStream out = response.getOutputStream();
response.setContentType("text/html"); // send HTML
out.println("<HTML><BODY>");
RandomAccessFile raf;
String filename = "yourfilename";
String s = "";
raf = new RandomAccessFile(filename, "r");
raf.seek(0);
while (s != null)
{
s = raf.readLine();
out.println(s);
}
out.println("</BODY></HTML>");
out.close();
raf.close();
return;
}
:^)
"A chain is only as strong as its weakest link."
Ricky Y. Artigas
Analyst/Programmer
Information Technology Division
Easycall Communications Phils., Inc.
- Easycall Internet -
418 Arayat St., Mandaluyong City 1550, Philippines
Personal WAP Site: http://www.buzzed.co.uk/mobile/?rya
Company Website: http://www.easycall.com.ph
Tel.no: (+632) 5338001 ext.6574
Mobile:(+63) 0917-8951783
Pager: 141-002955
Email: [EMAIL PROTECTED]
> -------------------------------
> IMPORTANT NOTICE:
> This message (and any attachment hereto) may contain privileged and/or
> confidential information specific to EasyCall. If you are not the intended
> addressee indicated in this message, you may not copy or disseminate this
> message (or any attachment hereto) to anyone. Instead, please destroy this
> message (and any attachment hereto), and kindly notify the sender by reply
> email. Any information in this message (and any attachment thereto) that
> do not relate to the official business of EasyCall shall be understood as
> neither given nor endorsed by the company.
>
>
> -----Original Message-----
> From: ken dias [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 9:59 AM
> To: [EMAIL PROTECTED]
> Subject: Re: to read a file and post to web-site
>
> Ricky
>
> have you tried jswdk? i tried it and can get the servlet examples to work
> but tried to change the helloworld servlet example, but it does not
> change.
> also how do i make up a servlet to read my file? is there any reference or
> book or have you tried this out?
>
> thanks
>
> Ken
>
>
> >From: "Artigas, Ricardo Y." <[EMAIL PROTECTED]>
> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology." <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: to read a file and post to web-site
> >Date: Wed, 25 Apr 2001 10:59:34 +0800
> >
> >hmm. or maybe you can just write the file as html file and place it in
> the
> >webserver's html directory..that is if the file would not change very
> >often.
> >But i think servlet is ok.
> >
> >:^)
> >"A chain is only as strong as its weakest link."
> >Ricky Y. Artigas
> >Analyst/Programmer
> >Information Technology Division
> >Easycall Communications Phils., Inc.
> >- Easycall Internet -
> >418 Arayat St., Mandaluyong City 1550, Philippines
> >Personal WAP Site: http://www.buzzed.co.uk/mobile/?rya
> >Company Website: http://www.easycall.com.ph
> >Tel.no: (+632) 5338001 ext.6574
> >Mobile:(+63) 0917-8951783
> >Pager: 141-002955
> >Email: [EMAIL PROTECTED]
> >
> >
> > > -------------------------------
> > > IMPORTANT NOTICE:
> >
> > > This message (and any attachment hereto) may contain privileged and/or
> > > confidential information specific to EasyCall. If you are not the
> >intended
> > > addressee indicated in this message, you may not copy or disseminate
> >this
> > > message (or any attachment hereto) to anyone. Instead, please destroy
> >this
> > > message (and any attachment hereto), and kindly notify the sender by
> >reply
> > > email. Any information in this message (and any attachment thereto)
> that
> > > do not relate to the official business of EasyCall shall be understood
> >as
> > > neither given nor endorsed by the company.
> > >
> > >
> > > -----Original Message-----
> > > From: ken dias [SMTP:[EMAIL PROTECTED]]
> > > Sent: Wednesday, April 25, 2001 9:07 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: to read a file and post to web-site
> > >
> > > hi folks,
> > >
> > > i have a QuickBasic program to read my printer port and store the data
> > > read
> > > in a file. i have a java program to read that file. now i want to post
> >the
> > > data read to a web-site. is a servlet the best way to do this or is
> >there
> > > an
> > > easier or better way?
> > > (my system is windows me and i use internet explorer).
> > >
> > > thanks
> > >
> > > ken
> > >
> >_________________________________________________________________________
> > > Get Your Private, Free E-mail from MSN Hotmail at
> >http://www.hotmail.com.
> > >
> > >
> >_________________________________________________________________________
> _
> > > _
> > > 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
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> __________________________________________________________________________
> _
> 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