Spring MVC - include static files / javascript , css

后端 未结 7 1997
猫巷女王i
猫巷女王i 2021-01-02 06:48

I have created MVC application.

I want to include js or css file into jsp.

My static files ar under:

- webapp
        -js/jquery.js
        -WEB-I         


        
相关标签:
7条回答
  • 2021-01-02 07:45

    Use spring JSTL tags to include external script files or style sheets. First you should include the the taglib in JSP as follows.

    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
    

    Then you can include extenal script file using,

    <script type="text/javascript" src="<spring:url value="/js/jquery.js"/>"></script>
    
    0 讨论(0)
提交回复
热议问题