黑猴子的家:JavaWeb 之 jsp 常用模板

1、Index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.alex.web.entity.BaseUser"%>
<%String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();%>
<%String contextPath = request.getContextPath();%>




Book Project






<%--
静态引入 
<%@ include file="" %>
动态引入
 
--%>



<%
    BaseUser baseUser = (BaseUser) session.getAttribute("baseUser");
    if (baseUser != null) {
        request.getRequestDispatcher("main.jsp").forward(request, response);
    } else {
        request.getRequestDispatcher("main.jsp").forward(request, response);
    }
%>


2、inc.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="org.apache.commons.lang3.StringUtils"%>
<%@page isELIgnored="false"  %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";%>
<%String contextPath = request.getContextPath();%>





















你可能感兴趣的:(黑猴子的家:JavaWeb 之 jsp 常用模板)