hello world servlet example
Step 1 : Create .java File using text editor
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ServletDemo extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML><HEAD><TITLE>WTAD</TITLE></HEAD> <body>");
String str="<h1>welcome to </h1>";
str=str+"<br>www.bipinrupadiya.blogspot.com";
out.println(str);
out.println("</body> </html>");
}
}
Step 2 : Go to Command prompt and compile it
Step 3 : Create Web Application structure and upload your .class / servlet file on server
Step 4 : Create web.xml
Step 4 : Explore your servlet
http://hostname/appName/my-address http://localhost:8081/bipin/wtad/bsr.co.in
n Protocol
n Custom URL for servlet
n Web Application name
n Host / domain name
Step 4 : output of servlet on Firefox
Subscribe to:
Post Comments (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.
1 comments:
Thank you sir.....
Post a Comment