Ciao,
ho un bel problema...stò iniziando a scrivere delle servlet per un esame universitario
Come richiesto dal professore ho installato Eclipse + GlassFish (l'application server scelto dal docente).
Perfetto...Eclipse mi vede correttamente GlassFish nella sezione server però non mi riconosce cose come le classi HttpServlet
Faccio un esempio pratico, ho il seguente codice:
Quando gli dico di eseguirmi questa semplicissima servlet sul server GlassFish, Eclipse mi dà i seguenti errori:codice:public class Esempio extends HttpServlet { static final long serialVersionUID = 33; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("<title>Io sono un titolo!</title>"); out.println("</head>"); out.println("<body bgcolor=\"white\">"); out.println("<h1>Questa è una prova!</h1>"); out.println("</body>"); out.println("</html>"); } }
Credo che dipenda da qualcosa relativo al classpath ed al fatto che non riesce a ritrovarsi la classe che gestisce le servlet, solo che non sò proprio come fare...sono 2 giorni che sono bloccatissimo su questa cosa...qualcuno sà per cado darmi una mano?codice:Description Resource Path Location Type HttpServlet cannot be resolved to a type Esempio.java /miaservlet/src line 5 Java Problem HttpServletRequest cannot be resolved to a type Esempio.java /miaservlet/src line 9 Java Problem HttpServletResponse cannot be resolved to a type Esempio.java /miaservlet/src line 10 Java Problem ServletException cannot be resolved to a type Esempio.java /miaservlet/src line 11 Java Problem The import javax.servlet cannot be resolved Esempio.java /miaservlet/src line 2 Java Problem The import javax.servlet cannot be resolved Esempio.java /miaservlet/src line 3 Java Problem
Grazie infinite
Andrea

Rispondi quotando