简体   繁体   中英

how do I move html pages to a new project/war file?

Suppose my existing Java project (that also has some JavaScript code) is named UI and has subdirs Func1 and Func2, each of which have some JavaScript files containing functions with parameters named 'url' and values of webpages within the UI project called things like 'resources/html/docs/myPage1.html' etc. ie, each of Func1 and Func2 have a resources/html subdirs with lots of different directories to organize their various webdocs.

Now suppose that I want to create a new project (at the UI) level called something like DOCS in which to consolidate all of the various html pages. ie, my project has grown to the point where I want to deploy a separate war in Tomcat to just warehouse all my html pages so that I can manage the documentation separately from the actual source code files that point to them.

How can I do this? I created a new DOCS project in my git repo and moved over all of the html pages from, say, UI/Func1/resources/html/docs/page1.html to the new location of DOCS/Func1/resources/html/docs/page1.html. But, how can the JavaScript programs that still live in places like UI/Func1/src/main/webapp/view/MyJS1.js be updated to cross a project domain boundary so that Tomcat can find the page pointed to in various function's url parameters in the new war file I'll build and deploy? Is there some maven pom magic to help make this happen?

TIA,

It turns out that there is some maven magic to make this work. In the new project's pom:

<plugin>
   <artifactId>maven-war-plugin</artifcatId>
   <version>2.4</version>
   <configuration>
      <failOnMissingWebXml>false</failOnMissingWebXml>
      <webResources>
         <resource>
            <directory>webapp</directory>
         </resource>
      </webResources>
   </configuration>
</plugin>

The JavaScript parameters were thus changed to http://localhost:8555/webdocs-0.0.1-SNAPSHOT/resources/html/docs/myPage1.html . And, setting a JS property for the prefix of these url's cleans things up nicely once the new warfile is built and tossed in the webapp directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM