Webjars CSS JS resource file Management

Source: Internet
Author: User

Webjars is a jar package that packages these generic web front-end resources into Java, and then manages them with MAVEN tools to ensure that these Web resource versions are unique and easy to upgrade. About Webjars Resources, there is a dedicated website http://www.webjars.org/, we can go to this site to find their own resources, in their own projects to add to Maven dependency, you can directly use these resources

1. Use

Add dependency

<dependency>            <groupId>org.webjars</groupId>            <artifactid>webjars-locator</ artifactid>            <version>0.1</version>        </dependency>        <dependency>            < groupid>org.webjars</groupid>            <artifactId>bootstrap</artifactId>            <version> 2.1.1</version>        </dependency>

  

2. Packaging:

<plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId> maven-war-plugin</artifactid>                <version>2.2</version>                <configuration>                    < failonmissingwebxml>false</failonmissingwebxml>                </configuration>            </plugin>

  

3. References

A. Static page:

<link rel= ' stylesheet ' href= ' webjars/bootstrap/2.1.1/css/bootstrap.min.css ' >    <script type= ' text/ JavaScript ' src= ' webjars/jquery/1.8.2/jquery.min.js ' ></script>    <script type= ' text/javascript ' src = ' Webjars/bootstrap/2.1.1/js/bootstrap.min.js ' ></script>         <script type= ' text/javascript ' src= ' Webjars/ajax-form/2.1.3/ajax-form.js ' ></script>  

b.jsp

<link rel= ' stylesheet ' href= ' <%= org.webjars.AssetLocator.getWebJarPath ("css/bootstrap.min.css")%> ' >    <script type= ' text/javascript ' src= ' <%= org.webjars.AssetLocator.getWebJarPath ("jquery.min.js")%> ' ></script>    <script type= ' text/javascript ' src= ' <%= org.webjars.AssetLocator.getWebJarPath ("js/ Bootstrap.min.js ")%> ' ></script>                      <script type= ' text/javascript ' src= ' <%= Org.webjars.AssetLocator.getWebJarPath ("Ajax-form.js")%> ' ></script>    

  

Webjars CSS JS resource file Management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.