<%@ page import="com.alex.web.entity.BaseUser"%><%String basePath = request.g..._jsp页面模板">
当前位置:   article > 正文

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

jsp页面模板

1、Index.jsp

  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ page import="com.alex.web.entity.BaseUser"%>
  3. <%String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();%>
  4. <%String contextPath = request.getContextPath();%>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  9. <title>Book Project</title>
  10. <script type="text/javascript" src="style/jquery/jquery-1.8.2.min.js"></script>
  11. <script type="text/javascript" src="<%=contextPath%>/style/js/json3.min.js"></script>
  12. <link rel="stylesheet" href="${pageContext.request.contextPath}/style/css/index.css">
  13. <script type="text/javascript">
  14. </script>
  15. <style type="text/css">
  16. </style>
  17. <%--
  18. 静态引入
  19. <%@ include file="" %>
  20. 动态引入
  21. <jsp:include page="inc.jsp" />
  22. --%>
  23. <jsp:include page="inc.jsp"></jsp:include>
  24. </head>
  25. <body>
  26. <%
  27. BaseUser baseUser = (BaseUser) session.getAttribute("baseUser");
  28. if (baseUser != null) {
  29. request.getRequestDispatcher("main.jsp").forward(request, response);
  30. } else {
  31. request.getRequestDispatcher("main.jsp").forward(request, response);
  32. }
  33. %>
  34. </body>
  35. </html>

2、inc.jsp

  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ page import="java.util.Map"%>
  3. <%@ page import="java.util.HashMap"%>
  4. <%@ page import="org.apache.commons.lang3.StringUtils"%>
  5. <%@page isELIgnored="false" %>
  6. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  7. <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
  8. <%String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";%>
  9. <%String contextPath = request.getContextPath();%>
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  11. <html>
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  14. <title></title>
  15. <script type="text/javascript" src="style/jquery/jquery-1.8.2.min.js"></script>
  16. <script type="text/javascript" src="style/bootstrap/js/bootstrap.min.js"></script>
  17. <script type="text/javascript" src="<%=contextPath%>/style/js/json3.min.js"></script>
  18. <link rel="stylesheet" type="text/css" href="style/bootstrap/css/bootstrap.css"/>
  19. <link rel="stylesheet" type="text/css" href="style/bootstrap/css/bootstrap-responsive.css" />
  20. <link rel="stylesheet" type="text/css" href="style/css/index.css" />
  21. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/index.css"/>
  22. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}style/foot/foot.css"/>
  23. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}style/head/head.css"/>
  24. <script type="text/javascript">
  25. </script>
  26. <style type="text/css">
  27. </style>
  28. </head>
  29. <body>
  30. </body>
  31. </html>
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/224289?site
推荐阅读
相关标签
  

闽ICP备14008679号