• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why error in setHeader()

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This:


should read:


Both methods are in HttpServletResponse, not ServletResponse.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic