Introduction to JSP and Servlet

Introduction

Servlets

What is servlet?

LifeCycle methods in servlet

Fig. Lifecycle of servlet.

Java Server Pages(JSP)

What is JSP?

JSP Scripting

<% any normal java code will work here. but declarative code will not %>
ex.
<% if(password.length() < 6) { errorMessage = "Enter correct password"} %>
<%= veriable-name %>
ex.
<p>First Name of a user is := <%= firstName %></p>
<%! declarative code here %>
ex.
<%!
public boolean validateEmail(String email) {
// code for validation.
}
%>
<%@page errorPage="error.jsp" /> // here this page gets called whenever error occurs.
<%@ include file="filepath"%>
<%@ taglib prefix = "mytag" uri="http://www.example.com/custlib"%>

Conclusion

--

--

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store