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>
posted @ 2018-11-01 13:46  山神笔记  阅读(9729)  评论(0编辑  收藏  举报