Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Java,Jsp,XML,BEANS Program

Java,Jsp,XML,BEANS Program

Ratings: (0)|Views: 223|Likes:
Published by alok kumar

More info:

Published by: alok kumar on May 29, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

01/01/2014

pdf

text

original

 
CREATE A SIMPLE SERVLET PROGRAM USINGHttpServlet
import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class Hello extends HttpServlet{public void doGet (HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException{PrintWriter out;String title = "Example of HttpServlet";// set content type and other response header fields firstresponse.setContentType("text/html");// then write the data of the responseout = response.getWriter();out.println("<HTML><HEAD><TITLE>");out.println(title);out.println("</TITLE></HEAD><BODYbgcolor=\"#FFFFFF\">");out.println("<H1>" + title + "</H1>");out.println("<H2>Hello WORLD!<br>");out.println("</BODY></HTML>");out.close();}}
 
OUTPUT:
 
CREATE A SIMPLE FORM AND DISPLAY THE VALUESUSING SERVLET PROGRAM
<html><body><form action="http://192.168.7.151/servlets/user"method=”get”>name:<input type="text" name=”pname”>age:<input type="text" name=”pid”><input type="submit" name="submit"value="submit"></form></body></html>import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class getform extends HttpServlet{public void doGet(HttpServletRequest request, HttpServletResponseresponse)throws IOException,ServletException{try{ response.setContentType("text/html");PrintWriter out = response.getWriter();String name=request.getParameter("pname");String id=request.getParameter("pid");out.println("<html>");out.println("<head>");out.println("<title>Retrieve</title>");out.println("</head>");out.println("<body>");out.println("NAme::"+ name+"<br>");out.println("Id::"+i d+"<br>");out.println("</body>");out.println("</html>");*/}catch(Exception e){ System.out.println("Error"+e); } }}

Activity (4)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
sugimapooja liked this
Madhu Bantu liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->