A method of optimizing JAVA Web program Resources __java

Source: Internet
Author: User
Tags java web
Optimization method of Java Web program resources

Author: Chszs, reprint should be indicated. Blog home: Http://blog.csdn.net/chszs
How to organize and optimize CSS and script file resources.

Many CSS and JavaScript resources are dispersed in different files and may have an impact on the loading speed of the Web page.

WRO4J is a useful API to minimize and compress Web resource files, including CSS and JavaScript files. WRO4J can be configured at build time-either with the appropriate MAVEN plug-in or through a filter at run time.



This article describes how to configure and use wro4j when building an application.

The first step is to define the groupings-the resources created and contained, which are implemented by creating the Wro.xml configuration file, which is placed in the Web-inf directory. As follows:

[HTML]  View plain copy print? <?xml version= "1.0"  encoding= "UTF-8"?>   <groups xmlns= "http://www.isdc.ro/" Wro ">     <group name=" javaonly-base-scripts ">        <js minimize= "false" >/scripts/jquery-1.6.1.min.js</js>        <js minimize= "false" >/scripts/jqXMLUtils.pack.js</js>        <js minimize= "false" >/scripts/cufon/cufon-yui.js</js>        <js minimize= "false" >/scripts/cufon/font.js</js>        <js minimize= "false" >/scripts/cufon/replace.js</js>     </group>      <group name= "javaonly-scripts" >       <js >/scripts/scriptFile1.js</js>       <js>/scripts/scriptfile2.js</js>       </group>     <group name = "Javaonly-debugging" >       <js minimize= "false" >/scripts/ scriptdebug1.js</js>       <js minimize= "false" >/scripts/ scriptdebug1.js</js>     </group>           <group name= "Javaonly-styles" >       <css>/styles/screen/ base.css</css>       <css>/styles/screen/layout.css</

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.