springboot异常

    1. 定义异常(专门一个文件夹 exception) ```java package com.atguigu.springboot.exception;

    public class UserNotExistException extends RuntimeException {

    1. public UserNotExistException() {
    2. super("用户不存在");
    3. }

    }

    1. 2. 定义异常处理器(controller层)
    2. ```java
    3. package com.atguigu.springboot.controller;
    4. import com.atguigu.springboot.exception.UserNotExistException;
    5. import org.springframework.web.bind.annotation.ControllerAdvice;
    6. import org.springframework.web.bind.annotation.ExceptionHandler;
    7. import org.springframework.web.bind.annotation.ResponseBody;
    8. import javax.servlet.http.HttpServletRequest;
    9. import java.util.HashMap;
    10. import java.util.Map;
    11. @ControllerAdvice
    12. public class MyExceptionHandler {
    13. //1、浏览器客户端返回的都是json
    14. // @ResponseBody
    15. // @ExceptionHandler(UserNotExistException.class)
    16. // public Map<String,Object> handleException(Exception e){
    17. // Map<String,Object> map = new HashMap<>();
    18. // map.put("code","user.notexist");
    19. // map.put("message",e.getMessage());
    20. // return map;
    21. // }
    22. @ExceptionHandler(UserNotExistException.class)
    23. public String handleException(Exception e, HttpServletRequest request){
    24. Map<String,Object> map = new HashMap<>();
    25. //传入我们自己的错误状态码 4xx 5xx
    26. /**
    27. * Integer statusCode = (Integer) request
    28. .getAttribute("javax.servlet.error.status_code");
    29. */
    30. request.setAttribute("javax.servlet.error.status_code",500);
    31. map.put("code","user.notexist");
    32. map.put("message","用户出错啦");
    33. request.setAttribute("ext",map);
    34. //转发到/error
    35. return "forward:/error";
    36. }
    37. }
    1. 自定义一个ErrorAttributes(在component) ```java package com.atguigu.springboot.component;

    import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestAttributes;

    import java.util.Map;

    //给容器中加入我们自己定义的ErrorAttributes @Component public class MyErrorAttributes extends DefaultErrorAttributes {

    1. //返回值的map就是页面和json能获取的所有字段
    2. @Override
    3. public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
    4. Map<String, Object> map = super.getErrorAttributes(requestAttributes, includeStackTrace);
    5. //我们的异常处理器携带的数据
    6. Map<String,Object> ext = (Map<String, Object>) requestAttributes.getAttribute("ext", 0);
    7. map.put("ext",ext);
    8. return map;
    9. }

    }

    1. 4. template文件夹中的error表标签
    2. - 404.html
    3. ```java
    4. <!DOCTYPE html>
    5. <!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
    6. <html lang="en">
    7. <head>
    8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    9. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    10. <meta name="description" content="">
    11. <meta name="author" content="">
    12. <title>Dashboard Template for Bootstrap</title>
    13. <!-- Bootstrap core CSS -->
    14. <link href="asserts/css/bootstrap.min.css" rel="stylesheet">
    15. <!-- Custom styles for this template -->
    16. <link href="asserts/css/dashboard.css" rel="stylesheet">
    17. <style type="text/css">
    18. /* Chart.js */
    19. @-webkit-keyframes chartjs-render-animation {
    20. from {
    21. opacity: 0.99
    22. }
    23. to {
    24. opacity: 1
    25. }
    26. }
    27. @keyframes chartjs-render-animation {
    28. from {
    29. opacity: 0.99
    30. }
    31. to {
    32. opacity: 1
    33. }
    34. }
    35. .chartjs-render-monitor {
    36. -webkit-animation: chartjs-render-animation 0.001s;
    37. animation: chartjs-render-animation 0.001s;
    38. }
    39. </style>
    40. </head>
    41. <body>
    42. <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
    43. <a class="navbar-brand col-sm-3 col-md-2 mr-0" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Company name</a>
    44. <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
    45. <ul class="navbar-nav px-3">
    46. <li class="nav-item text-nowrap">
    47. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Sign out</a>
    48. </li>
    49. </ul>
    50. </nav>
    51. <div class="container-fluid">
    52. <div class="row">
    53. <nav class="col-md-2 d-none d-md-block bg-light sidebar">
    54. <div class="sidebar-sticky">
    55. <ul class="nav flex-column">
    56. <li class="nav-item">
    57. <a class="nav-link active" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    58. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
    59. <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
    60. <polyline points="9 22 9 12 15 12 15 22"></polyline>
    61. </svg>
    62. Dashboard <span class="sr-only">(current)</span>
    63. </a>
    64. </li>
    65. <li class="nav-item">
    66. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    67. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
    68. <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
    69. <polyline points="13 2 13 9 20 9"></polyline>
    70. </svg>
    71. Orders
    72. </a>
    73. </li>
    74. <li class="nav-item">
    75. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    76. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart">
    77. <circle cx="9" cy="21" r="1"></circle>
    78. <circle cx="20" cy="21" r="1"></circle>
    79. <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
    80. </svg>
    81. Products
    82. </a>
    83. </li>
    84. <li class="nav-item">
    85. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    86. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
    87. <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
    88. <circle cx="9" cy="7" r="4"></circle>
    89. <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
    90. <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
    91. </svg>
    92. Customers
    93. </a>
    94. </li>
    95. <li class="nav-item">
    96. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    97. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart-2">
    98. <line x1="18" y1="20" x2="18" y2="10"></line>
    99. <line x1="12" y1="20" x2="12" y2="4"></line>
    100. <line x1="6" y1="20" x2="6" y2="14"></line>
    101. </svg>
    102. Reports
    103. </a>
    104. </li>
    105. <li class="nav-item">
    106. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    107. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-layers">
    108. <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
    109. <polyline points="2 17 12 22 22 17"></polyline>
    110. <polyline points="2 12 12 17 22 12"></polyline>
    111. </svg>
    112. Integrations
    113. </a>
    114. </li>
    115. </ul>
    116. <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
    117. <span>Saved reports</span>
    118. <a class="d-flex align-items-center text-muted" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    119. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
    120. </a>
    121. </h6>
    122. <ul class="nav flex-column mb-2">
    123. <li class="nav-item">
    124. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    125. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    126. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    127. <polyline points="14 2 14 8 20 8"></polyline>
    128. <line x1="16" y1="13" x2="8" y2="13"></line>
    129. <line x1="16" y1="17" x2="8" y2="17"></line>
    130. <polyline points="10 9 9 9 8 9"></polyline>
    131. </svg>
    132. Current month
    133. </a>
    134. </li>
    135. <li class="nav-item">
    136. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    137. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    138. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    139. <polyline points="14 2 14 8 20 8"></polyline>
    140. <line x1="16" y1="13" x2="8" y2="13"></line>
    141. <line x1="16" y1="17" x2="8" y2="17"></line>
    142. <polyline points="10 9 9 9 8 9"></polyline>
    143. </svg>
    144. Last quarter
    145. </a>
    146. </li>
    147. <li class="nav-item">
    148. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    149. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    150. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    151. <polyline points="14 2 14 8 20 8"></polyline>
    152. <line x1="16" y1="13" x2="8" y2="13"></line>
    153. <line x1="16" y1="17" x2="8" y2="17"></line>
    154. <polyline points="10 9 9 9 8 9"></polyline>
    155. </svg>
    156. Social engagement
    157. </a>
    158. </li>
    159. <li class="nav-item">
    160. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    161. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    162. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    163. <polyline points="14 2 14 8 20 8"></polyline>
    164. <line x1="16" y1="13" x2="8" y2="13"></line>
    165. <line x1="16" y1="17" x2="8" y2="17"></line>
    166. <polyline points="10 9 9 9 8 9"></polyline>
    167. </svg>
    168. Year-end sale
    169. </a>
    170. </li>
    171. </ul>
    172. </div>
    173. </nav>
    174. <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
    175. <h1>status:[[${status}]]</h1>
    176. <h2>timestamp:[[${timestamp}]]</h2>
    177. </main>
    178. </div>
    179. </div>
    180. <!-- Bootstrap core JavaScript
    181. ================================================== -->
    182. <!-- Placed at the end of the document so the pages load faster -->
    183. <script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" ></script>
    184. <script type="text/javascript" src="asserts/js/popper.min.js" ></script>
    185. <script type="text/javascript" src="asserts/js/bootstrap.min.js" ></script>
    186. <!-- Icons -->
    187. <script type="text/javascript" src="asserts/js/feather.min.js" ></script>
    188. <script>
    189. feather.replace()
    190. </script>
    191. <!-- Graphs -->
    192. <script type="text/javascript" src="asserts/js/Chart.min.js" ></script>
    193. <script>
    194. var ctx = document.getElementById("myChart");
    195. var myChart = new Chart(ctx, {
    196. type: 'line',
    197. data: {
    198. labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
    199. datasets: [{
    200. data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
    201. lineTension: 0,
    202. backgroundColor: 'transparent',
    203. borderColor: '#007bff',
    204. borderWidth: 4,
    205. pointBackgroundColor: '#007bff'
    206. }]
    207. },
    208. options: {
    209. scales: {
    210. yAxes: [{
    211. ticks: {
    212. beginAtZero: false
    213. }
    214. }]
    215. },
    216. legend: {
    217. display: false,
    218. }
    219. }
    220. });
    221. </script>
    222. </body>
    223. </html>

    1. - 5××.html
    2. ```html
    3. <!DOCTYPE html>
    4. <!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
    5. <html lang="en">
    6. <head>
    7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    8. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    9. <meta name="description" content="">
    10. <meta name="author" content="">
    11. <title>Dashboard Template for Bootstrap</title>
    12. <!-- Bootstrap core CSS -->
    13. <link href="asserts/css/bootstrap.min.css" rel="stylesheet">
    14. <!-- Custom styles for this template -->
    15. <link href="asserts/css/dashboard.css" rel="stylesheet">
    16. <style type="text/css">
    17. /* Chart.js */
    18. @-webkit-keyframes chartjs-render-animation {
    19. from {
    20. opacity: 0.99
    21. }
    22. to {
    23. opacity: 1
    24. }
    25. }
    26. @keyframes chartjs-render-animation {
    27. from {
    28. opacity: 0.99
    29. }
    30. to {
    31. opacity: 1
    32. }
    33. }
    34. .chartjs-render-monitor {
    35. -webkit-animation: chartjs-render-animation 0.001s;
    36. animation: chartjs-render-animation 0.001s;
    37. }
    38. </style>
    39. </head>
    40. <body>
    41. <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
    42. <a class="navbar-brand col-sm-3 col-md-2 mr-0" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Company name</a>
    43. <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
    44. <ul class="navbar-nav px-3">
    45. <li class="nav-item text-nowrap">
    46. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">Sign out</a>
    47. </li>
    48. </ul>
    49. </nav>
    50. <div class="container-fluid">
    51. <div class="row">
    52. <nav class="col-md-2 d-none d-md-block bg-light sidebar">
    53. <div class="sidebar-sticky">
    54. <ul class="nav flex-column">
    55. <li class="nav-item">
    56. <a class="nav-link active" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    57. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
    58. <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
    59. <polyline points="9 22 9 12 15 12 15 22"></polyline>
    60. </svg>
    61. Dashboard <span class="sr-only">(current)</span>
    62. </a>
    63. </li>
    64. <li class="nav-item">
    65. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    66. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
    67. <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
    68. <polyline points="13 2 13 9 20 9"></polyline>
    69. </svg>
    70. Orders
    71. </a>
    72. </li>
    73. <li class="nav-item">
    74. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    75. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart">
    76. <circle cx="9" cy="21" r="1"></circle>
    77. <circle cx="20" cy="21" r="1"></circle>
    78. <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
    79. </svg>
    80. Products
    81. </a>
    82. </li>
    83. <li class="nav-item">
    84. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    85. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
    86. <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
    87. <circle cx="9" cy="7" r="4"></circle>
    88. <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
    89. <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
    90. </svg>
    91. Customers
    92. </a>
    93. </li>
    94. <li class="nav-item">
    95. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    96. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart-2">
    97. <line x1="18" y1="20" x2="18" y2="10"></line>
    98. <line x1="12" y1="20" x2="12" y2="4"></line>
    99. <line x1="6" y1="20" x2="6" y2="14"></line>
    100. </svg>
    101. Reports
    102. </a>
    103. </li>
    104. <li class="nav-item">
    105. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    106. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-layers">
    107. <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
    108. <polyline points="2 17 12 22 22 17"></polyline>
    109. <polyline points="2 12 12 17 22 12"></polyline>
    110. </svg>
    111. Integrations
    112. </a>
    113. </li>
    114. </ul>
    115. <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
    116. <span>Saved reports</span>
    117. <a class="d-flex align-items-center text-muted" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    118. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
    119. </a>
    120. </h6>
    121. <ul class="nav flex-column mb-2">
    122. <li class="nav-item">
    123. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    124. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    125. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    126. <polyline points="14 2 14 8 20 8"></polyline>
    127. <line x1="16" y1="13" x2="8" y2="13"></line>
    128. <line x1="16" y1="17" x2="8" y2="17"></line>
    129. <polyline points="10 9 9 9 8 9"></polyline>
    130. </svg>
    131. Current month
    132. </a>
    133. </li>
    134. <li class="nav-item">
    135. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    136. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    137. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    138. <polyline points="14 2 14 8 20 8"></polyline>
    139. <line x1="16" y1="13" x2="8" y2="13"></line>
    140. <line x1="16" y1="17" x2="8" y2="17"></line>
    141. <polyline points="10 9 9 9 8 9"></polyline>
    142. </svg>
    143. Last quarter
    144. </a>
    145. </li>
    146. <li class="nav-item">
    147. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    148. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    149. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    150. <polyline points="14 2 14 8 20 8"></polyline>
    151. <line x1="16" y1="13" x2="8" y2="13"></line>
    152. <line x1="16" y1="17" x2="8" y2="17"></line>
    153. <polyline points="10 9 9 9 8 9"></polyline>
    154. </svg>
    155. Social engagement
    156. </a>
    157. </li>
    158. <li class="nav-item">
    159. <a class="nav-link" href="http://getbootstrap.com/docs/4.0/examples/dashboard/#">
    160. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
    161. <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
    162. <polyline points="14 2 14 8 20 8"></polyline>
    163. <line x1="16" y1="13" x2="8" y2="13"></line>
    164. <line x1="16" y1="17" x2="8" y2="17"></line>
    165. <polyline points="10 9 9 9 8 9"></polyline>
    166. </svg>
    167. Year-end sale
    168. </a>
    169. </li>
    170. </ul>
    171. </div>
    172. </nav>
    173. <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
    174. <h1>status:[[${status}]]</h1>
    175. <h2>timestamp:[[${timestamp}]]</h2>
    176. <h2>exception:[[${exception}]]</h2>
    177. <h2>message:[[${message}]]</h2>
    178. <h2>ext:[[${ext.code}]]</h2>
    179. <h2>ext:[[${ext.message}]]</h2>
    180. </main>
    181. </div>
    182. </div>
    183. <!-- Bootstrap core JavaScript
    184. ================================================== -->
    185. <!-- Placed at the end of the document so the pages load faster -->
    186. <script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" ></script>
    187. <script type="text/javascript" src="asserts/js/popper.min.js" ></script>
    188. <script type="text/javascript" src="asserts/js/bootstrap.min.js" ></script>
    189. <!-- Icons -->
    190. <script type="text/javascript" src="asserts/js/feather.min.js" ></script>
    191. <script>
    192. feather.replace()
    193. </script>
    194. <!-- Graphs -->
    195. <script type="text/javascript" src="asserts/js/Chart.min.js" ></script>
    196. <script>
    197. var ctx = document.getElementById("myChart");
    198. var myChart = new Chart(ctx, {
    199. type: 'line',
    200. data: {
    201. labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
    202. datasets: [{
    203. data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
    204. lineTension: 0,
    205. backgroundColor: 'transparent',
    206. borderColor: '#007bff',
    207. borderWidth: 4,
    208. pointBackgroundColor: '#007bff'
    209. }]
    210. },
    211. options: {
    212. scales: {
    213. yAxes: [{
    214. ticks: {
    215. beginAtZero: false
    216. }
    217. }]
    218. },
    219. legend: {
    220. display: false,
    221. }
    222. }
    223. });
    224. </script>
    225. </body>
    226. </html>

    若有收获,就点个赞吧

    0 人点赞

    展开/收起文章目录