Having a minor problem which hopefully someone can advise me on. I have a
'service' class that calls the 'printAddPage' of this class
(AddComponentManager). This generates a HTML form, which (when the user
submits) in turn calls the 'doPost' method of this page. Unfortunately,
when the doPost method is called, the server (Java Web Server1.1.1) returns
a 404 file not found. Any ideas why this is falling over (comments about
how I'm going about this would also be welcomed).
Cheers,
Pete
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javabook.*;
import COREClasses.*;
class AddComponentManager
{
private String appletForm =
"c:\\JavaWebServer1.1.1\\public_html\\CORE\\resources\\appletForm.html";
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = new PrintWriter(res.getOutputStream(), true);
out.println("Page called successfully");
}
public void printAddPage(HttpServletRequest req, HttpServletResponse res,
String userName) throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = new PrintWriter(res.getOutputStream(), true);
out.println("<HTML><HEAD><TITLE>");
out.println("Add Component</TITLE></HEAD>");
out.println("<BODY>");
out.println("<H1>Add Component to CORE</H1>");
out.println("Please enter the component code you wish to add to CORE in
the fields below.");
out.println("You may associate a text description with this code in the
box provided.");
out.println("<FORM METHOD=\"POST\"
ACTION=\"../../servlet/AddComponentManager\">");
out.println("<INPUT TYPE=HIDDEN NAME=\"task\" VALUE=\"add\">");
out.println("<TABLE BORDER=0 WIDTH=100%><TR><TD VALIGN=TOP><B>Component
Code</B>");
out.println("</TD><TD><TEXTAREA NAME=\"componentDetails\" ROWS=30
COLS=80></TEXTAREA>");
out.println("</TD></TR><TR><TD VALIGN=TOP><B>Component
description</B></TD>");
out.println("<TD><TEXTAREA NAME=componentDescription ROWS=20
COLS=80></TEXTAREA>");
out.println("</TD></TR></TABLE><P>");
out.println("<INPUT TYPE=\"submit\" VALUE=\"Submit
Component\"><P><INPUT
TYPE=\"reset\" VALUE=\"Reset\">");
out.println("</FORM><HR WIDTH=80%></BODY></HTML>");
}
public String getServletInfo()
{
return "CORE control class to add component.";
}
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
doGet(req, res);
}
}
------------------------------------------------------------------------
Peter Hornsby,
Department of Computer Science
Loughborough University,
Loughborough,
Leicestershire,UK EMAIL:[EMAIL PROTECTED]
LE11 3TU. Tel: +44 (0)1509 222799
Fax: +44 (0)1509 211586
"Learning how to not fool ourselves is, I'm sorry to say,
something that we haven't specifically included in any
particular course that I know of. We just hope you've
caught it by osmosis." - Richard Feynman
------------------------------------------------------------------------
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html