springboot和jsp,以及引入jquery


包:

   src:

     main:

        java:

        resources:

            static:

            templates:

     test:

2.在static導入jquery源文件,在templates寫入jsp文件

3.配置文件:

server.port=8888
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.jsp

4.mvc自動略掉jquery,交個tomcat處理:

   

@Configuration
public class MyMvcConfig extends WebMvcConfigurationSupport {


@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
super.addResourceHandlers(registry);
}
}

5.jquery導入jsp:
<script type="text/javascript" src="../static/jquery.js">
</script>

<script>
// $(function () {
// alert("ccccccccccc")
// })

$(document).ready(function () {
alert("hhhhhhhhh")
})

alert("ggggggg")
</script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM