Results 1 to 2 of 2

Thread: jsp VS Servlet

  1. #1
    waqar100 is offline Member
    Join Date
    May 2010
    Rep Power

    Default jsp VS Servlet

    I want to know JSP VS servlet with examples & flow..

  2. #2
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Rep Power


    Thats very broad question you asked. Its good to use jsp and servlet togethere. So, just create a form in jsp and get those data in servlet.
    e.g. // test.jsp
    // whatever data we seding the form data to a servlet called "MyServlet" for further processing
    <form name = "form1" method = "POST" action = "MyServlet">
    Name:<input type = "text" name = "name">
    <input type = "submit" value = "submit">

    //now create a servlet called MyServlet

    public class MyServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {

    PrintWriter out = response.getWriter();
    //fetch the form data sent by jsp page
    String pname = request.getParameter("name");

    //print the name
    out.println("You entered:\t"+pname);


Similar Threads

  1. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  2. Servlet to Servlet connection through URLConnection
    By bsrjavaforum in forum Networking
    Replies: 0
    Last Post: 04-01-2009, 04:12 PM
  3. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  4. Replies: 0
    Last Post: 08-30-2008, 11:52 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts