英文:
how can i import js file on my jsp file in springboot
问题
以下是翻译好的部分:
jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!-- 静态内容 -->
<link rel="stylesheet" href="/resources/css/style.css">
<script type="text/javascript" src="/resources/js/app.js"></script>
<title>Spring Boot</title>
</head>
<body>
<h1>Spring Boot - MVC web application example</h1>
<hr>
<div class="form">
<form action="hello" method="post" onsubmit="return validate()">
<table>
<tr>
<td>Enter Your name</td>
<td><input id="name" name="name"></td>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
app.properties
spring.mvc.view.prefix = /WEB-INF/views/
spring.mvc.view.suffix = .jsp
spring.mvc.static-path-pattern=/resources/**
tree
java
-*.java
resources
-css
--*.css
-js
--*.js
webapp
-WEB-INF
--view
---*.jsp
英文:
i just load css and js on my jsp
but it just load css not js
this is my code
jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!-- Static content -->
<link rel="stylesheet" href="/resources/css/style.css">
<script type="text/javascript" src="/resources/js/app.js"></script>
<title>Spring Boot</title>
</head>
<body>
<h1>Spring Boot - MVC web application example</h1>
<hr>
<div class="form">
<form action="hello" method="post" onsubmit="return validate()">
<table>
<tr>
<td>Enter Your name</td>
<td><input id="name" name="name"></td>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
app.properties
spring.mvc.view.prefix = /WEB-INF/views/
spring.mvc.view.suffix = .jsp
spring.mvc.static-path-pattern=/resources/**
tree
java
-*.java
resources
-css
--*.css
-js
--*.js
webapp
-WEB-INF
--view
---*.jsp
专注分享java语言的经验与见解,让所有开发者获益!
评论