• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Servlet » introduction » Jsp To Servlet Communication
Next →
← Prev

Jsp To Servlet Communication

By Dinesh Thakur

JSP is a tag-based language, i.e., code is written within specified tags. It is developed by Sun Microsystems. Unlike servlet program, we can write HTML tags within the JSP program, making it easier to build.

When a servlet JSP communication is taking place, it is not just about forwarding the request to a JSP from a servlet. There might be a need to transfer a string value or an object itself.

In the JSP program we use simple HTML tags to take input from the client but we will save the file as a .jsp extension and then we will retrieve the data in the servlet program.

                 

Login.html

<center>

<form action=”login” method=”get” >

USERNAME <input type=’text’ name=’t1′><br>

PASSWORD <input type=’text’ name=’t2′><br>

<input type=”submit” value=”login” >

<input type=”reset” value=”reset” >

</form>

</center>

Login·java

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

public class Login extends HttpServlet

{

           public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException

       {

               res.setContentType(“text/html”);          

               String usname=req.getParameter(“t1”);

               String pass=req.getParameter(“t2”);

               PrintWriter pw=res.getWriter();

               pw.println(“USERNAME IS : “+usname);

               pw. println (” PASSWORD IS : “+pass) ;

               pw.close();

        }

}

To test the application

https://ecomputernotes.com:portno/login.jsp

You’ll also like:

  1. Servlet to JSP Communication
  2. Html To JSP Communication
  3. Database To JSP Communication
  4. Html to Servlet Communication
  5. Applet to Servlet Communication
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

Servlet Tutorials

Servlet Tutorials

  • Servlet - Home
  • Servlet - Types
  • Servlet - Advantages
  • Servlet - Container
  • Servlet - API
  • Servlet - Chaining
  • Servlet - Life Cycle
  • Servlet - Developement Way
  • Servlet - Servlet Vs CGI
  • Servlet - Server Side
  • Servlet - HttpServletRequest
  • Servlet - Cookies Advantages
  • Servlet - JDBC Architecture
  • Servlet - HttpServlet
  • Servlet - HttpServletResponse
  • Servlet - Web Technology
  • Servlet - Applet Communication
  • Servlet - Html Communication
  • Servlet - HTTP POST Request
  • Servlet - HTTP GET Request

Other Links

  • Servlet - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW