SQL Oracle Java JSP JDBC MORE

JSP request implicit object with Example


The JSP request is an implicit object of type HttpServletRequest.

It is used to get request information such as parameter, header information, remote address, server name, server port, content type, character coding etc.

Request implicit object is used to get the data on a JSP page which has been entered by user on the previous JSP or HTML page.

Example of JSP request implicit object

index.html

<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<form action="home.jsp">
<input type="text" placeholder="first name" name="fname"> <br><br>
<input type="text" placeholder="last name" name="lname"> <br> <br>
<input type="submit" value="submit"><br>
</form>
</body>
</html>

home.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Request </title>
</head>
<body>
<%
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
out.print("First Name :"+fname);
out.println("<br>");
out.print("Last Name :"+lname);
%>
</body>
</html>

Output

JSP request
JSP Request Implicit