Watch “JSP Part-5 | Page Directive attributes example (Gujarati)” on YouTube

Jdk #Java #JSP #JavaServerPages #Scriplet #PageDirectiveAttributes #Gujarati #RaviROza

Video features the following:

  • usage of page attributes in JSP

Following are the list of files used in example

  • index.jsp
  • myerror.jsp
index.jsp
<%@ page 	
	language="java" 
	contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"  
    errorPage="/myerror.jsp"         
    %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Page Directives</title>
</head>
<body>
<h1>JSP Page Directives Demo</h1>
<h3>Ravi R. Oza</h3>
<hr/>

<%
	String name = null;
	int n = name.length();
        //   or try below
	//int n=100/0;
%>
</body>
</html>
myerror.jsp
<%@ page isErrorPage="true" %>

<h1> OOPS, There is an Error</h1>

<h2> Please check the input or wait for server to response.</h2>
<font color="red">
 
<%= exception %>
</font>

Summary

  • It is used to provide instructions to a container that connect to current JSP page.
  • It defines page dependent properties/attributes such as scripting language, error page, etc., which communicates with the Web Container at the time of page translation.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

Follow me @
https://raviroza.wordpress.com/
https://raviroza.blogspot.com/
https://www.facebook.com/ravi.oza.it
https://twitter.com/raviozaIT

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101