Hi, I´ve installed Tomcat and I've been testing it: I wrote some .html and .jsp files and tried then in the server. They semm to work correctly together. For example: these files I'm trying allow me to upload a file to the server and writes its name in a database (mysql). Once this is done I have a button that allows me to upload another file or I can consult the name of the files stored in the database.
My problem comes when I need to run a servlet. I'm trying a basic one:
package HelloWorldServlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class HelloWorldServlet extends HttpServlet {
public void init(ServletConfig conf)
throws ServletException
{
super.init(conf);
}
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Hello World</h1;>");
out.println("</body>");
out.println("</html>");
}
}
From that I get a .class file. I put this file in: webapps/HelloWord/web-inf/classes
i really don't know how to modify the web.xml file and how to call this servlet from an .html or .jsp page
Thanks to all who can help me.