Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7576701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:59:08+00:00 2026-05-30T16:59:08+00:00

I am developing a Java Web application with Spring MVC and I am having

  • 0

I am developing a Java Web application with Spring MVC and I am having a little problem in here.

I am sending .css files to W3C to validate the code, this part work just fine (the validation part), but to do this I need the route of the .css files in my project so I can create the file object and send it to the W3C.

I do not know how to (in my logic) write the path to the css files. I do not want to use absolute paths so I can move my app to any server without problems.

After deploying the project the WAR its moved to the servlet and the structure of the project folder is not the same than the WAR!

I have no idea how to tell to my logic where to find the .css files!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:59:09+00:00Added an answer on May 30, 2026 at 4:59 pm

    Ok I figure it out how to do this! Here its how

        String me = this.getClass().getName().replace(".", "/")+".class";
        me = this.getClass().getClassLoader().getResource(me).getPath();
        String[] route = me.split("WEB-INF");
        String servletUri = route[0];
        fileNameCSS = servletUri+"resources/css/"+file;
    

    So what Im doing here ? first of all I get the name of the class im in, then I use the getResource of my class and ask for the path of it! Thits its giving me the path of the hole project in the server (/home/bterra/OneX/WEB-INF/ etc etc)!

    Now I have the info a wanted! the route of my project in the server! Then I just split the string in “WEB-INF” to get the server path to concat later the name of the folder where my css are and the name of the css I want to validate!

    I sure this its not the best way to do this … but it works for me! If you guys know a better way or the correct way to do this … plx let me know!

    Thanks for all!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Java/Spring web application. The problem I'm currently facing is that I'd
I'm having a problem with java sessions. I'm developing a simple web app, where
We're developing a data heavy modular web application stack with java but have little
I am developing an application in Spring Web MVC where i need to execute
I am developing my first Java web application (Spring/Hibernate/Freemarker) and my only concern is
I am developing a web application with spring mvc on eclipce under linux. What
I'm developing bunch of relatively small Spring based java web-application. I'm mostly using annotations
I am developing a Spring (Java framework for server-side web-development)web application, which will respond
I am developing a medium size Java Web Application with Struts as MVC framework
I'm developing a Java Web Application that runs a series of financial calculations for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.