Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » HttpServlet "cannot be resolved to a type"
HttpServlet "cannot be resolved to a type" [message #92967] Tue, 19 April 2005 02:02 Go to next message
Eclipse UserFriend
Originally posted by: jbailo.vestcom.com

I'm trying to run this code (see below) from a tutorial about creating a
web applicaiton in Eclipse.

The problem is the "HttpServlet" throws a message in the IDE that it:

"Cannot be resolved to a type". Why?

____________________________________________________________ ____________________

package org.eclipse.wtp.tutorial;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SnoopServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String userAgent = req.getHeader("user-agent");
String clientBrowser = "Not known!";
if( userAgent != null)
clientBrowser = userAgent;
req.setAttribute("client.browser",clientBrowser );
req.getRequestDispatcher("/showBrowser.jsp").forward(req,resp);
}
}
Re: HttpServlet "cannot be resolved to a type" [message #94772 is a reply to message #92967] Mon, 25 April 2005 14:59 Go to previous message
plork123 is currently offline plork123Friend
Messages: 174
Registered: July 2009
Senior Member
Did yu get this snoop servlet to work ???




"John Bailo" <jbailo@vestcom.com> wrote in message
news:d41pah$cad$1@news.eclipse.org...
>
> I'm trying to run this code (see below) from a tutorial about creating a
> web applicaiton in Eclipse.
>
> The problem is the "HttpServlet" throws a message in the IDE that it:
>
> "Cannot be resolved to a type". Why?
>
> ____________________________________________________________ ____________________
>
> package org.eclipse.wtp.tutorial;
>
> import java.io.IOException;
>
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> public class SnoopServlet extends HttpServlet {
> public void doGet(HttpServletRequest req, HttpServletResponse resp)
> throws ServletException, IOException {
> String userAgent = req.getHeader("user-agent");
> String clientBrowser = "Not known!"; if( userAgent != null)
> clientBrowser = userAgent;
> req.setAttribute("client.browser",clientBrowser );
> req.getRequestDispatcher("/showBrowser.jsp").forward(req,resp);
> }
> }
Previous Topic:Tomcat realm and Catalina conf
Next Topic:Extending HTML editor for *.php
Goto Forum:
  


Current Time: Tue Jul 16 17:27:26 GMT 2024

Powered by FUDForum. Page generated in 0.03792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top