hello...
i am write a programme for copy file and stores into each another file.like this way i want to copy multiple files.but the error null pointer is coming.. why the value is not displayed?I can't understand null pointer exception..
the code
<%@ page language="java"%>
<%@ page import="java.io.*"%>
<%@ page import="java.text.*"%>
<html>
<head>
<title>
</title>
</head>
<body>
<%
try
{
String cname=request.getParameter("cname");
String category=request.getParameter("category");
String submit=request.getParameter("submit");
int len;
File f1=new File(request.getParameter("file"));
File f2=new File("ee/file1.txt");
InputStream is=new FileInputStream(f1);
OutputStream os=new FileOutputStream(f2);
byte buf[]=new byte[1024];
%>
Company Name is:<%out.println(cname);%>
Category :<%out.println(category);%>
<%
while((len=is.read(buf))>0)
{
os.write(buf,0,len);
out.println("file copied");
}
is.close();
os.close();
out.println("file copied");
}
catch(FileNotFoundException ex)
{
out.println(ex);
}
catch(IOException eo)
{
out.println(eo);
}
catch(Exception e)
{
out.println(e);
}
finally
{
out.println("");
}
%>
</body>
</html>