Hi,
Put your class file in Jser/servlets directory.
Hope it helps.
----- Original Message -----
From: <lubisak@h...>
To: "Java Server" <pro_java_server@p...>
Sent: Thursday, March 08, 2001 6:23 PM
Subject: Re: Page cannot be found error
> Your JavaForm.class is not there where is suppose to be. I've never used
> JServ and cannot tell you exatly where is that place. But probably if you
> have "example" folder most likely that JServ has already been configured
> to access servlets inside that directory. There should be "WEB-INF"
> folder and inside "classes" folder. If so try putting your classes there.
>
> Also there is JServ configuration section in Pro_Java_Server book.
>
> > Help somebody please!
> >
> > I am getting a page cannot be found error when attempting to use a form
> in
> > a html page that references a servlet. I have basically been following
> the
> > chapter 2 example of sending an e-mail from a servlet.
> >
> > The html page has this code inside it:
> >
> > <FORM method="post"
> > action="http://www.globalfinanceonline.com/servlets/JavaForm">
> >
> > The rest of the page is just the text field names and values that are
> sent
> > to the servlet who's source code is:
> >
> > file://Import Servlet Libraries
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > file://Import Java Libraries
> > import java.io.*;
> > import java.util.*;
> >
> > file://Import SMTP class
> > import sun.net.smtp.SmtpClient;
> >
> > file://Import html helper class
> > import com.wrox.util.*;
> >
> > public class JavaForm extends HttpServlet
> > {
> > String message, msgFrom, msgTo, msgSubject;
> >
> > public void doPost(HttpServletRequest req, HttpServletResponse res)
> > throws ServletException, IOException
> > {
> > res.setContentType("text/html");
> > PrintWriter out = res.getWriter();
> > getParameters(req);
> >
> > if(!sendMail())
> > {
> > res.sendError(res.SC_INTERNAL_SERVER_ERROR, "An Error has
> > occurred while attempting to access the mail server.");
> > return;
> > }
> >
> > file://Send acknowledgement to the browser
> > HTML h = new HTML("GlobalFinanceOnline IT Dept");
> > h.add(HTML.HEADING, "Your Request has been submitted",
> > false);
> > out.println(h.getPage());
> > out.close();
> > }
> >
> > private void getParameters(HttpServletRequest req)
> > throws ServletException, IOException
> > {
> > StringBuffer tempStringBuffer = new StringBuffer(1024);
> > msgSubject = "Tech Support Request";
> > msgTo = "chris@g...";
> > msgFrom = req.getParameter("txtEmail");
> >
> > tempStringBuffer.append("From: ");
> > tempStringBuffer.append(req.getParameter("txtFirst"));
> > tempStringBuffer.append(" ");
> > tempStringBuffer.append(req.getParameter("txtLast"));
> > tempStringBuffer.append("\n");
> > tempStringBuffer.append("Phone: ");
> > tempStringBuffer.append(req.getParameter("txtPhone"));
> > tempStringBuffer.append("\n");
> > tempStringBuffer.append("Email: ");
> > tempStringBuffer.append(req.getParameter("txtEmail"));
> > tempStringBuffer.append("\n\n");
> > tempStringBuffer.append("Software: ");
> > tempStringBuffer.append(req.getParameter("ddlb_software"));
> > tempStringBuffer.append("\n");
> > tempStringBuffer.append("OS: ");
> > tempStringBuffer.append(req.getParameter("ddlb_os"));
> > tempStringBuffer.append("\n\n");
> > tempStringBuffer.append("Problem: ");
> > tempStringBuffer.append(req.getParameter("txtProblem"));
> > tempStringBuffer.append("\n");
> >
> > message = tempStringBuffer.toString();
> > }
> >
> > private boolean sendMail()
> > {
> > PrintStream out;
> > SmtpClient send;
> >
> > try
> > {
> > file://Replace the following with your outgoing
> > SMTP Client
> > send = new SmtpClient
> > ("smtpmail.freenetname.co.uk");
> > send.from(msgFrom);
> > send.to(msgTo);
> > out = send.startMessage();
> >
> > out.println("From: " + msgFrom);
> > out.println("To: " + msgTo);
> > out.println("Subject: " + msgSubject);
> > out.println("\n---------------------\n");
> > out.println(message);
> > out.println("\r\n");
> > out.println("\n---------------------\n");
> > out.flush();
> > out.close();
> > send.closeServer();
> > }
> > catch (IOException e) {
> > log("Error occurred while sending mail",
> > e);
> > return false;
> > }
> > return true;
> > }
> > }
> >
> >
> > The servlet resides on our server which is running Apache jServ 1.7. The
> > HTML page sits in this folder:
> >
> > http://www.globalfinanceonline.com/java/java_form.html
> >
> > Also the above servlet uses a class file called HTML.class to compile it
> > (if this could be the problem).
> >
> > Can anyone tell me why this is happening?
> >
>