JSP---web.xml中设置前后台不同的头部和底部
Posted 有挫败才有成长
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSP---web.xml中设置前后台不同的头部和底部相关的知识,希望对你有一定的参考价值。
目录结构
header.jspf
<%@ page pageEncoding="utf-8" %> <html> <head></head> <body> <h1 style="background:#999;color:#fff;padding:10px;">hello website.</h1>
admin_header.jspf
<%@ page pageEncoding="utf-8" %> <html> <head></head> <body> <h1 style="background:#999;color:#fff;padding:10px;">hello admin information management system.</h1>
footer.jspf
<%@ page import="java.util.Calendar" pageEncoding="utf-8" %> <h1 style="background:#999;color:#fff;padding:10px;">©2000-<%= Calendar.getInstance().get(Calendar.YEAR) %> beast-king corp.</h1>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <jsp-config> <jsp-property-group> <url-pattern>/main/*</url-pattern> <page-encoding>UTF-8</page-encoding> <default-content-type>text/html</default-content-type> <include-prelude>/jspf/header.jspf</include-prelude> <include-coda>/jspf/footer.jspf</include-coda> </jsp-property-group> <jsp-property-group> <url-pattern>/admin/*</url-pattern> <page-encoding>UTF-8</page-encoding> <default-content-type>text/html</default-content-type> <include-prelude>/jspf/admin_header.jspf</include-prelude> <include-coda>/jspf/footer.jspf</include-coda> </jsp-property-group> </jsp-config> </web-app>
以上是关于JSP---web.xml中设置前后台不同的头部和底部的主要内容,如果未能解决你的问题,请参考以下文章