Posted By:
jawwad_ahmed
Posted On:
Friday, November 30, 2001 04:41 AM
Well i can not load image i have puted in the images folder.gives null pointer exception import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.net.*; public class SetCookie extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException, ServletException { res.setContentType("image/gif"); ServletOutputStream sop=res.getOutputStream(); System.out.println(getServletContext().getResourceAsStream("c:/tomcat2/webapps/examples/images/code.gif")); int ival=is.read(); while(ival!=-1) {
More>>
Well i can not load image i have puted in the images folder.gives null pointer exception
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.net.*;
public class SetCookie extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException, ServletException
{
res.setContentType("image/gif");
ServletOutputStream sop=res.getOutputStream();
System.out.println(getServletContext().getResourceAsStream("c:/tomcat2/webapps/examples/images/code.gif"));
int ival=is.read();
while(ival!=-1)
{
sop.write(ival);
ival=is.read();
}
}
}
<<Less