Salve a tutti è da un pò che sto cercado di entrare ed imparare nel linguaggio java ma ogni tanto trovo un problemino
Sto cercando di imparare le servlet e le jsp..ho fatto una prima applicazione che praticamente mi chiede di scegliere(digitando il relativo nome)tra tre tipi di notizie...una volta selezionato la notizia i dovrebbe aprire il file jsp corrispondente ma non riesco a capire dove sbaglio...vi linko il codice rispettivamente della Servlet,Index,Web.xml:
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 Notizia extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String categoria=request.getParameter("categoria");
String JspNotizia="";
if(categoria.equals("politica")){
JspNotizia="JSPnotizie/politica.jsp";
}else if(categoria.equals("meteo")){
JspNotizia="JSPnotizie/meteo.jsp";
}else if(categoria.equals("sport")){
JspNotizia="JSPnotizie/sport.jsp";
}else JspNotizia="JSPnotizie/error.jsp";
request.getRequestDispatcher(JspNotizia).forward(r equest,response);
}
}
..................................
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Scelta Notizia</title>
</head>
<body bgcolor="Black" text="red">
<div align="center">
<font size="5" face="Arial">PROGRAMMA SEMPLICE PER LA SCELTA DELLE NOTIZIE IN JSP</font>
</div>
<div align="center">
<form action="src/Notizia.java">
Scrivere quale notizia di desidera inserire tra: Sport,Meteo,Politica<input name="categoria" type="text" value="digitare qui la scelta">
<input type="submit" value="Mostra la scelta">
</form>
</div>
</body>
</html>
.................................................
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>PrimaServlet</display-name>
<servlet>
<display-name>Notizia</display-name>
<servlet-name>MainNotizia</servlet-name>
<servlet-class>Notizia</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MainNotizia</servlet-name>
<url-pattern>/Notizia</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Index.html</welcome-file>
</welcome-file-list>
</web-app>
Spero possiate aiutarmi
Ringraziamenti anticipati saluti
atomix


Rispondi quotando
) il significato di quello che ho fatto sostituendo Notizia.do?Inoltre perchè quest'estensione.do?a che file fa rifermiento?
