Relative paths that plague Tomcat and eclipse

Source: Internet
Author: User
Tags relative tomcat

Due to inexperience, a relative path to web design is a problem that has been troubling for half a day.

The first step:

Eclipse creates a new dynamic Web Project, which is conceived as a mayaa+html way to handle the presentation layer of the Web for easy page design.

The directory structure is as follows:

WebContent

+css

+img

-web-inf

-index.html

-index.mayaa

Step Two:

Using Dreamweaver to design HTML pages, the related images and CSS files are relative paths (such as:. /CSS/STYLE.CSS), after the page design is complete, can be displayed in the browser normally, also can preview in Eclipse normal.

Step Three:

Go back to eclipse and do some dynamic processing, then run on server, start Tomcat, run the web.

At this point, the problem arises, Through the Tomcat run index.html cannot find the CSS and image resources, originally thought is the problem of mayaa, the results found that the browser display incorrect page save overwrite index.html, the page can display normally, in order to know, or relative path setting problem.

One idea flashed, since the site root directory is webcontent, then why not try to change the path to css/style.css it, sure enough, so that it can be displayed normally.

However, neither eclipse nor Dreamweaven can be visualized, and the path can only be changed manually.

It was a bit of a hassle, so it was done for the time being.

If the netizen can provide a better solution, welcome message to give advice.

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.