i am doing an acadamic java project by using html, servlets.
in html form tag what is the url that i have to give in post attribute.
and i am using access as my database. it is giving that httpserver error
that given table is not found. will u please help me in sorting out this problem

10 Years
Discussion Span
Last Post by Nilesh Pagar

In the form tag you must put the url in the 'action' attribute and in the 'method' attribute you put post or get:

<form action="someurl" method="post">

When you submit the form you send the information that are inside it to the given url
And I would suggest to use .jsp to build your pages not servlets


<form action="url"mehtod="post"/>
but this url should identify which servlet to run at server side.

in your web.xml, your

<url-pattern>this pttern should identify your action url properly</url-pattern>

if action="*.do" then
url patter should be



well, that form tag you posted won't do as it's seriously malformed...

Well, then you will have a tough time in your project. Anyways it works for me.

Deploy below files in tomcat or any Servlet Container.

Directory structure should be like this.


1) index.html

        <form action="sample.do" method="post">
            <input type="submit" name="myName" ></input>

2) Servlet.java

package com.sample;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SampleServlet extends HttpServlet{

    private static final long serialVersionUID = -8734960688756643493L;

    protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
        service(arg0, arg1);
    protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
        service(arg0, arg1);

    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("<HTML>" +
                    "<HEAD>Sample</HEAD>" +
                    "<BODY>\n" +
                    "<H1>Hello World</H1>\n" +
                    "</BODY>" +
                    "</HTML>");  }


3) web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">





4) servlet-api.jar
download it from

Deploy this application and check if it works. If this also doesn't work then best luck.:D

And by the way *.do url is properly functioning in this sample web project.:-O

And about the database error, it might not have been configured properly, provided if you are not doing anything logically or syntactically wrong in your code which connects D:'( B.

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.