Application of Servlet-Jdbc and HTML

I designed One web page name login.html in which I put Login and Password textbox for user. When User press button("submit") I check Login and Password with Oracle database through Servlet and Jdbc.If he is valid user then I want to open another web Page named reguser.html? how ? please help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use the following code to do this.

 where response is of type HttpServletResponse

This wil work.Try
tejasmehta71Author Commented:
I got given error while using code.
403 forbidden
will not serve files , only servlets.

tejasmehta71Author Commented:
Adjusted points to 75
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

On the "submit" button of your HTML page, invoke the servlet

The script should look something like

<FROM METHOD=POST ACTION="/your servlet virtual directory/yourservletname>

Overide the doPost() method in the servlet so that it connects to the database, and on authentication redirects the user to the page you specify  in sendRedirect method.


port 80 is the stadard port for HTTP requests.

"path" is the virtual pathname that is mapped to the physical path of your document directory on your webserver.

If you have any doubts, you could try and invoke this page through your web browser to check whether the path is mapped to the physical path on your webserver.
tejasmehta71Author Commented:
Adjusted points to 100
tejasmehta71Author Commented:
Thank for reply.
to make it more easy herewith I write code for the same.

1 file :
import javax.servlet.*;
import javax.servlet.http.*;

public class FirstServlet extends HttpServlet
      public void doGet(HttpServletRequest request,
                                       HttpServletResponse response)
                                       throws ServletException,IOException
            String log = request.getParameter("lg");
            String pwd = request.getParameter("pwd");
            PrintWriter pw = response.getWriter();
            if(log.equals("tejas mehta"))
                  // I want to start reguser.html in same directory.

2 file : FirstServlet.html
<form name="form1"
      action = "http://localhost:8080/servlet/FirstServlet">
      <td>Login name</td>
      <td><input type=textbox name="lg" size="10" value=""></td>
      <td><input type=password name="pwd" size="10" value=""></td>
<input type=submit value="Submit">

3 : I am using ServletRunner from c:\jsdk2.0\bin

4: I am not working in any kind of networking

5: question is when reg user press submit It has to start another html file.

6: I solve same question by starting another servlet in which wrote html coding. but this is not right way to do project.
Try this.

if(log.equals("tejas mehta"))

This is perfectly working for me.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dear tejasmehta71,

I forgot one thing.You should specify
the exact path within your site

ie..response.sendRedirect("/servlet/reguser.html") that.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.