Ciao a tutti ragazzi,
sto da poco avvicinandomi a java e sto vedendo un pò di esempi per capire come sono fatti magari anche modificandoli...
Insomma, dopo avere scritto hello word e aver visto qualch eservlet ora è la volta di questa servlet che proprio nn vuole andare.
Il codice preso da un esmpio online è questo:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class DesignPageServlet extends HttpServlet
{
//Initialize global variables
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String sBKCOLOR = request.getParameter("BKCOLOR");
String sTITLE = request.getParameter("TITLE");
String sMESSAGE = request.getParameter("MESSAGE");
response.setContentType("text/html");
PrintWriter out = new PrintWriter (response.getOutputStream());
out.println("<html>");
out.println("<head><title>" + sTITLE + "</title></head>");
out.println("<body bgColor=" + sBKCOLOR + ">");
out.println("<h1>" + sTITLE + "</h1>");
out.println("
" + sMESSAGE);
out.println("</body></html>");
out.close();
}
}
ma continua a darmi quest'errore:
HTTP Status 405 - HTTP method GET is not supported by this URL
--------------------------------------------------------------------------------
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
--------------------------------------------------------------------------------
Apache Tomcat/4.1.18
Cosa potrà mai essere...?e possibile che ancora prima di cercar di modificarla nn mi funziona...?
:gren:
Ciao Giuseppe R.