Jdk #Java #JSP #JavaServerPages #Scriplet #IncludeDirectiveTag #IncludeDirective #Gujarati #RaviROza
Video features the following:
- Usage of Include Directive tag
- Inclusion of any java/html/jsp resource in jsp file
Following are the list of files used in example
- index.jsp
- header.html
- footer.html
- search.jsp
- about.jsp
- contact.jsp
index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>JSP Include Tag Example</title> </head> <body> <%@ include file="header.html" %> <h2>Content of index page is this </h2> <p> <p> <p> <p> <p> <p> <p> <p> <%@ include file="footer.html" %> </body> </html>
header.html
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>header</title> </head> <body> <h1 align="center">Ravi R. Oza (header)</h1> <p align="right"> <a href="index.jsp"> Home </a> | <a href="search.jsp"> Search </a> | <a href="contact.jsp"> Contact </a>| <a href="about.jsp"> About </a> <hr/> </p> </body> </html>
footer.html
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>footer</title> </head> <body> <hr/> <p align="center"> <h3>2020 Copyrights reserved to RaviROza (footer)</h3> </p> </body> </html>
search.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="ISO-8859-1"> <title>search</title> </head> <body> <%@ include file="header.html" %> <h2> SEARCH </h2> Search : <input type="text"> <p> <p> <p> <p> <p> <p> <p> <p> <%@ include file="footer.html" %> </body> </html>
about.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="ISO-8859-1"> <title>contact</title> </head> <body> <%@ include file="header.html" %> <h3>About me </h3> <h2> Myself Ravi R. Oza </h2> <h4> Myself Educator, Blogger, YouTuber, Learner </h4> <p> <p> <p> <p> <p> <p> <p> <p> <%@ include file="footer.html" %> </body> </html>
contact.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="ISO-8859-1"> <title>contact</title> </head> <body> <%@ include file="header.html" %> <h2>Contact me </h2> <p> Mail me : Ravi.oza.it@gmail.com <p> Follow me on Youtube @RaviROza <p> <p> <p> <p> <p> <p> <p> <p> <%@ include file="footer.html" %> </body> </html>
In this example index page used as home page.
Header.jsp contains the header information such as website name, logo & menus.
Footer.jsp contains the footer information such as quick links, company’s policies etc.,
Search.jsp is used to find the information from website.
About.jsp is the page which holds the info related to company history & its objective past and future work
Contact.jsp is the contact page which is useful when client want to communicate with the company.
Summary:
JSP Include Directive is the best way to have reuseability, where a the content of one page or resources can be merged to existing Jsp
OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7
Follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it
Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101