0% found this document useful (0 votes)
60 views

Coding Java10

The document describes how to create a Java server-side application using servlets that can be invoked from an HTML client. It outlines the hardware and software requirements, provides a 4-step algorithm to build the client and server, shows the HTML and servlet code, and notes that the servlet was successfully deployed and invoked from the HTML client to display output.

Uploaded by

Venu Pmu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Coding Java10

The document describes how to create a Java server-side application using servlets that can be invoked from an HTML client. It outlines the hardware and software requirements, provides a 4-step algorithm to build the client and server, shows the HTML and servlet code, and notes that the servlet was successfully deployed and invoked from the HTML client to display output.

Uploaded by

Venu Pmu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

INVOKING SERVLET FROM HTML

DATE:21.9.10

Aim:
To create a java server side application using servlet and invoke it from a HTML
client .

Hardware requirements:
Intel pentium Processor IV
128mb RAM

Software requirements:
Jdk1.6.0

Algorithm:
1. Create a client using HTML It get the username and password from
the user. When you submit the form it invoke the servlet.
2. Create a server using servlet It receive the data from client and display
the result to the client.
3. Deploy the servlet in to the server.
4. Run the client and server application . When you submit the client
form it invoke the servlet and the server display the result to the client.
INVOKING SERVLET FROM HTML

HTML CODING:

<html>
<head><title>WELCOME TO MY SERVLET</title></head>
<body>

<form action="C:\jdk1.3\bin\HelloServlet" method="post">


<center>
<br><br><br><br><br>
Name : <input type="text" name="name"><br><br>
Password: <input type="password" name="pwd"><br><br>
<input type="SUBMIT" name="submit" value="submit">
</center>
</form>
</body>
</html>

SERVLET CODING:

import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
public class HelloServlet extends HttpServlet
{
public void doPost(HttpServletRequest req,HttpServletResponse res)throws
ServletException,IOException
{
PrintWriter out=res.getWriter();
res.setContentType("text/html");
String name=req.getParameter("name");
String pwd=req.getParameter("pwd");
out.println("<html>");
out.println("<body>");
out.println("WELCOME!!!!!!" + name);
out.println("</html>");
out.println("</body>");
out.close();
}
}
OUTPUT:

RESULT:
Thus the servlet has been deployed and invoked from the HTML client.

You might also like