Hi
how can I read data fo database from client machine
through servlet.  if i want to read database of client
machine and update my database in server .....
how to Use IP adds to read data from machine ....
following code is working with console application but
not in applet or servlet .Not even throwing exception.

import java.io.*;
import java.io.Reader;
import java.io.FileInputStream;
import java.io.BufferedReader;
import java.awt.* ;
import java.applet.* ;
import javax.swing.event.EventListenerList ;

public class input extends Applet
{
        Button browse =new Button("Browse");
        Button ok =new Button("  O.K. ");
        Label lbPath = new Label("PATH:",Label.RIGHT);
        TextField path = new TextField(35);
    String str ="" ,strdir ="",strfile ="",strpath="";
public void init()
{
 add(lbPath);
 add(path);
 add(browse);
 add(ok);
}
public boolean action(Event evtobj,Object arg)
{
 if(evtobj.target instanceof Button)
 {
        if(arg.equals("Browse"))
        {
         Frame f = new Frame();
         FileDialog fd = new FileDialog(f);
         fd.show();
         strdir =fd.getDirectory();
         strfile = fd.getFile();
         strpath=strdir+strfile;
         CheckString cs = new  CheckString(strpath);//class
tomake \ into \\
         strpath = cs.checkNote();
         path.setText(strpath);
         System.out.println(strpath);
         repaint();
        }
        if(arg.equals("  O.K. "))
        {
                 try
                {
                FileInputStream fin = new
FileInputStream(strpath);
        ing strvin="c:\\windows\\desktop\\"+strfile;
                System.out.println(strvin);
        FileOutputStream fout = new FileOutputStream(strvin);
        while(true)
        {
         byte b=(byte)fin.read();
         fout.write(b);
         System.out.print(b);
        }
        }
        catch(EOFException ef){
                System.out.println("END OF FILE "+ef.getMessage());
                }
        catch(IOException ef1){
                        System.out.println("IO exeception
"+ef1.getMessage());
                }
catch(Exception e){
        }
        }
}
return true;
}

public void start()
{
}
public void paint(Graphics g)
{
}
public void stop()
{
}
public void destroy()
{
}

}//end of class

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.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

Reply via email to