This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "why error in setHeader()" Watch "why error in setHeader()" New topic

why error in setHeader()

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
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;
out.println(new java.util.Date());

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

Joined: Mar 22, 2005
Posts: 42958

should read:

Both methods are in HttpServletResponse, not ServletResponse.
It is sorta covered in the JavaRanch Style Guide.
subject: why error in setHeader()
It's not a secret anymore!