Skip to main content

How to use Jquery in JSP for user authentication

Hey users we all knows benefits of jquery and this is used by most of developers.Here now this tutorial is related
to show jquery magic with jsp (Java Server Pages). Actually i'm posting this article because it took a long time when when i was finishing my project.
So come to main point what things we required ?
  1. JSP page from where request goes to server to check user authintication.
  2. Servlet where cheking is been done.
  3. A jquery code to check the response and perform its task to validate user.
 A response is sent back to jsp and action is performed by jquery. In this example i used bootstrap model for my login area.


Front End Code (JSP):




Jquery Code:


You can put this code either on seprate file and call it in head section or put in the same jsp file with its script tag.




Servlet Code:

i had used EJB technique and method is written in session bean in which query is written. This method is called from servlet which is shown below.

 List login =sessionbean.login(name,password);        
         int t=login.size();       
         if(t==0)
         {
            response.getWriter().write("Wrong Username Or Password");
         }
         else
         {
             HttpSession session=request.getSession(true);
             session.setAttribute("currentSessionUser", name);
                  
            response.getWriter().write("Welcome");   
         }

Comments

Popular posts from this blog

Network Topologies (Tutorial-4)

Topology refers to the way in which the network of computers is connected. The choice of topology is dependent upon--- Type and number of equipment being used  Planned applications and rate of data transfers  Required response times  Cost Types of Network Topologies Physical Topology: Physical topology defines how devices are connected to the network through the actual cables that transmit data(physical structure of the network)  Logical Topology: Logical Topology (also referred to as Signal Topology) is a network computing term used to describe the arrangement of devices on a network and how they communicate with one another.

Networking (Tutorial-8) IEEE Standards

IEEE INTRODUCTION Institute of Electrical And Electronics professional organization for the advancement of technology related to electricity.  Formed in 1963 by the merger of IRE( Institute of Radio Engineers ) and AIEE(American Institute of Electrical Engineering)  IEEE is one of the leading standards-making organizations in the world. IEEE performs its standards making and maintaining functions through the IEEE Standards Association(IEEE-SA).  IEEE Standards The Institute of Electrical and Electronics Engineers Standards Association (IEEE-SA) is a leading developer of global industry standards in a broad-range of industries, including:  Power and Energy  Biomedical and Healthcare  Information Technology  Telecommunications  Transportation  Nanotechnology  Information Assurance  Development of IEEE Standards The IEEE standards development process can be broken down into seven basic steps, as follows: ...

Cisco Hierarchical Model

Cisco Hierarchical Model Defined by Cisco to simplify the design, implementation, and maintenance of responsive, scalable, reliable, and cost-effective networks. The 3 layers are logical and not physical – there may be many devices in a single layer, or a single device may perform the functions of 2 layers, eg: core and distribution. The Cisco Hierarchical Model