It is another my post. Today we ceate very simple JSP project in Netbeans.
So open Netbeans IDE and from menu choose File->New Project.
In New Project window from Categories select Java Web and from Projects choose Web Application.
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" media="screen" href="css/main.css"> <title><%= request.getParameter("title") %></title> </head> <body>
In the footer.jsp file paste this code:
<%@page contentType="text/html" pageEncoding="UTF-8"%> </body> </html>
<%@page contentType="text/html" pageEncoding="UTF-8"%> <jsp:include page="header.jsp"> <jsp:param name="title" value="My website"/> </jsp:include> <h1>It is my first website in JSP.</h1> <jsp:include page="footer.jsp" />
All files contain page directive with contentType attribute and pageEncoding attribute. In index.jsp file adding header and footer file is by means of include directive with page attribute. If you would like to add param to this part website you must add in include tags (with page attribute) param tag with name of param and its value. In this example we add title of website into it.
Run your application.