Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Servlet Question

  Asked By: Emily    Date: Sep 22    Category: Java    Views: 569

Have a simple servlet question. I got an error message when testing
Hello servlet. I am attaching the code it is from a text book. I am
using IIS and compliled the java code to generate class files using
sunOne studio. The HTML file is not connecting to the servlet. Could
you please let me know.
<FORM METHOD=GET ACTION="/servlet/Hello">
If you don't mind me asking, what is your name?
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Hello extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

PrintWriter out = res.getWriter();

String name = req.getParameter("name");
out.println("<HEAD><TITLE>Hello, " + name + "</TITLE></HEAD>");
out.println("Hello, " + name);

public String getServletInfo() {
return "A servlet that knows the name of the person to whom
it's" +
"saying hello";



4 Answers Found

Answer #1    Answered By: Emily Brown     Answered On: Sep 22

I am using IIS and trying to connect from a HTML Page to a servlet.
HTML page is unable to connect to the servlet. Could somebody help
me with that.

Answer #2    Answered By: Jarrod Williams     Answered On: Sep 22

To connect to a servlet, you need a servlet  engine. You can download the
TomCat servlet engine from this link:


It's a servlet engine that works under many web servers including the IIS.

Answer #3    Answered By: Evelyn Hughes     Answered On: Sep 22

put the java code  in <% %> and then try again..

Answer #4    Answered By: Douglas Sullivan     Answered On: Sep 22

could you please tell us what is error  message displayed so that it
would be easy to identify

Didn't find what you were looking for? Find more on Servlet Question Or get search suggestion and latest updates.