JSP <%@ include%> example

Source: Internet
Author: User

<%@ include%>: All code is included and processed together and eventually compiled into a servlet.

Adding top and bottom.jsp pages to the JSP file

emplist.jsp

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><%@ taglib URI="Http://java.sun.com/jsp/jstl/core"prefix="C" %><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Web01</title><styletype= "Text/css">Body{Margin-left:100px;}table, TH, TD{Border:1px solid Black;}</style></Head><Body><%@ include file="top.jsp" %><formAction= "/web01/empcontroller"Method= "Get">Employee Name:<inputtype= "text"name= "Searchtxt"><inputtype= "Submit"value= "Search"><BR/><Table>    <TR>        <th>Employee number</th>        <th>Employee Name</th>        <th>Position</th>        <th>Leader number</th>        <th>Date of employment</th>        <th>Wages</th>        <th>Bonus</th>        <th>Department number</th>    </TR>    <C:foreachItems= "${requestscope.empbean}"var= "EMP">    <TR>        <TD>${emp.empno}</TD>         <TD>${emp.ename}</TD>        <TD>${emp.job}</TD>        <TD>${emp.mgr}</TD>        <TD>${emp.hiredate}</TD>        <TD>${emp.sal}</TD>        <TD>${emp.comm}</TD>        <TD>${emp.deptno}</TD>    </TR>    </C:foreach></Table></form><%@ include file="bottom.jsp" %></Body></HTML>

top.jsp page

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><H1>Employee Management System</H1><HR>

bottom.jsp page

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><%@ Page Import="java.util.*, com.test.common.util.*" %><HR>Query result time is<%=Dateutil.formatdatetostr (New Date())%>

Test results:

JSP <%@ include%> example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.