MyEclipse Forums
This thread has been locked & this forum has been archived.
Please post new topics to General Development
View previous topic Printable version Log in to check your private messages View next topic
Author Message
sonoerin
Post subject: css not found?  PostPosted: Jul 22, 2011 - 05:22 AM
Veteran Member
Veteran Member


Joined: Jul 22, 2005
Posts: 107

I have a tomcat application that will rely heavily on css/js. Unfortunately, I can't seem to get my stylesheets picked up in tomcat, but they are in Eclipse. here is my dir structure (edited for brevity):

project
|-src
|-webapp
|-- WEB-INF
|---css
\---default.css
|---javascript

Here is my html:
Code:

<!DOCTYPE html>
<html>
   <link href="WEB-INF/css/default.css" rel="stylesheet" type="text/css" />
   <div id="header">
      <h1>
         Office Name
      </h1>
   </div>
   <div id="navigation">
      <ul>
         <li>
            <a href="#">Home</a>
         </li>
         <li>
            <a href="#">About</a>
         </li>
         <li>
            <a href="#">Services</a>
         </li>
         <li>
            <a href="#">Contact us</a>
         </li>
      </ul>
   </div>
   <div id="aside">
      <h3>
         Aside heading
      </h3>
      <p>
         Various menu choices go here
      </p>
   </div>
   <div id="content-container">
      <div id="content">
         <h2>
            Page heading
         </h2>
         <p>
            paragraph one
         </p>
         <p>
            paragraph two
         </p>
         <p>
            paragraph three
         </p>
      </div>
   </div>
   </div>
   <div id="footer">
      Copyright © me, 2011
   </div>
</html>

But it feels like the web.xml is not allowing the css or js files thru. So here it is:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
   <display-name>project</display-name>

   <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:applicationContext.xml</param-value>
   </context-param>
   <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
   <listener>
      <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
   </listener>
   <servlet>
      <servlet-name>project</servlet-name>
      <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
        <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>com.project.resources</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
      <servlet-name>project</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>
</web-app>


Any ideas?
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-swapna
Post subject:   PostPosted: Jul 22, 2011 - 07:07 AM



Joined: Nov 11, 2010
Posts: 2490

sonoerin ,

Can you try placing the CSS files under the WEBROOT folder instead of WEB-INF folder?

Let us know how it works for you.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
sonoerin
Post subject:   PostPosted: Jul 22, 2011 - 12:11 PM
Veteran Member
Veteran Member


Joined: Jul 22, 2005
Posts: 107

I moved my css/default.css under webapp/ and it was still not picked up. When I try and view the css directly in the browswer with "css/default.css" I get a 404.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-swapna
Post subject:   PostPosted: Jul 25, 2011 - 05:48 AM



Joined: Nov 11, 2010
Posts: 2490

sonoerin ,

Your directory structure is different from MyEclipse directory structure. So you will have to create a new web project in MyEclipse and copy the files of your Eclipse project to the corresponding folders to be able to work with MyEclipse.

I suggest you create a new Web project in MyEclipse IDE and place the CSS files in the WEBROOT folder of the project. This should fix the issue.

Here is a tutorial on web projects in MyEclipse which will help you :
http://www.myeclipseide.com/documentation/quickstarts/webprojects/

Let us know how it works for you.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits