wood burning stoves 2.0*
The moose likes Servlets and the fly likes why error in setHeader() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "why error in setHeader()" Watch "why error in setHeader()" New topic
Author

why error in setHeader()

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class first extends HttpServlet{
public void doGet(ServletRequest req,ServletResponse res) throws ServletException,IOException{
PrintWriter out=res.getWriter();
long mseconds;
java.util.Date date=new java.util.Date();
mseconds=date.getTime() + 10000;
res.setHeader("Content-Type","text/html");
res.setDateHeader("Expires",mseconds);
out.println("<html><body>");
out.println(new java.util.Date());
out.println("</Body></html>");
}
}

Dear sir in the above code when i am compiling this program then there is a two error that
can't find symbole setHeader()
can't find symbole setDateHeader()
why sir why?
with regard
Arun kumar maalik
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
This:


should read:


Both methods are in HttpServletResponse, not ServletResponse.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why error in setHeader()
 
Similar Threads
PersonalizeWelcome servlet question...
Software requirements??
Cannot able to Find Methods
how to acces a remote servlet from a java client?????
compiling and deploying into Tomcat