HttpServlet "cannot be resolved to a type" [message #92967] |
Mon, 18 April 2005 22:02  |
Eclipse User |
|
|
|
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 10:59  |
Eclipse User |
|
|
|
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);
> }
> }
|
|
|
Powered by
FUDForum. Page generated in 0.05192 seconds