Problem with moving JSPs under WEB-INF directory

Problem with moving JSPs under WEB-INF directory

Ask Question

10 years, 6 months ago

6 years, 9 months ago

7k times




I am facing a problem when I move my JSP files along with CSS and JS files under WEB-INF/web/ directory. The problem is that, when a JSP page loads, it does not load CSS and JS files. Please help if you have any idea about it.



java jsp jakarta-ee struts web-inf

share|improve this question

edited Sep 2 ’09 at 5:20


68.9k6262 gold badges231231 silver badges338338 bronze badges

asked Sep 2 ’09 at 4:44


12.9k1717 gold badges5757 silver badges7777 bronze badges

add a comment

4 Answers





Unless you want to write controllers to serve the css/js files in the WEB-INF folder, you will need to move those files out of WEB-INF so that they can be served as static files by the app server.

share|improve this answer

answered Sep 2 ’09 at 5:16

Jason FritcherJason Fritcher

1,43399 silver badges1212 bronze badges

add a comment


WEB-INF is not web accessible, you need to put css/js into public_html(www) as browser loads them through http.

share|improve this answer

answered Sep 2 ’09 at 5:10


97k6666 gold badges284284 silver badges311311 bronze badges

add a comment


You can use the contextPath to retrieve any file from the foot folder,this way can work with files inside and outside WEB-INF folder.

You can make like this

<link rel=”stylesheet” href=”${pageContext.request.contextPath}/css/fromStyle.css” type=”text/css”>

share|improve this answer

answered Oct 11 ’11 at 22:44


7,4792525 gold badges9090 silver badges148148 bronze badges

add a comment


To access ‘WEB-INF’ use


share|improve this answer

answered Jun 4 ’13 at 12:07


1,01355 gold badges1919 silver badges3131 bronze badges

add a comment

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password


Post as a guest


Required, but never shown

Post Your Answer


By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged java jsp jakarta-ee struts web-inf or ask your own question.

The Overflow Blog

Defending yourself against coronavirus scams

Podcast Episode 220: Fully Remote

Featured on Meta

Planned maintenance scheduled for Saturday, March 28, 2020 at 13:00 UTC (9AM…

An Update On Creative Commons Licensing

Community and Moderator guidelines for escalating issues via new response…

How does the Triage queue work?

Triage needs to be fixed urgently, and users need to be notified upon…



Are struts2 actions called when user asks for a jsp through a search engine


2web-inf and jsp page directives3Error moving JSP file into WEB-INF directory with Stripes3How to put JSP in WEB-INF correct?960Can’t start Eclipse – Java was started but returned exit code=135Moving resources under WEB-INF2Include JSP file under WEB-INF folder0Preventing access to WEB-INF from JSP0How to access a jsp page inside a folder under WEB-INF?1Accessing JSP in subfolder within WEB-INF folder?

Hot Network Questions

Since every human has a different DNA (different combinations of C, G, A, T) what does it mean to have the genome done?

Why is paragliding not an old invention?

Four distinct 8-bit integers

Assign [email protected] to another variable in a shell function

What is the point of this resistor network?

How can a BBEG activate or deactivate anti-magic tiles on its turn?

Can I safely plug a two prong plug into an extension cord with a ground socket?

Is it true that Netscape Navigator eventually became Mozilla Firefox?

How does FM station have fixed frequency when FM modulation changes the frequency?

Broadcasting to unknown Class C Network

What kind of LEGO are these?

Is the COVID-19 pandemic curve a Gaussian curve?

If a caster readies Time Stop and casts it as a reaction during another creature’s turn, what happens to that creature’s turn?

Why would a ‘first world’ alien opt to have a brood of dumb children rather than one smart one?

I have a YMA Visa – will Germany let me into the country despite COVID-19?

What to do if my undergrad hasn’t prepared me well for grad school?

Were there any travel restrictions during the Black Death pandemic?

Why are shorter hours such a problem for companies?

Why does cloth simulation not work on a NURBS sphere which has been converted to a mesh?

Why is the effect called Dodge?

When we press a piano key, why does a high pitch note not run for as long as a low pitch note?

Replacing parts of a Matrix with lists

Why don’t laws have examples?

Can a wormhole be created if it has not always existed?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


Leave a Reply

Your email address will not be published. Required fields are marked *