Reputation: 35
I have created Struts2 application using Maven. In this application I have created two namespaces, first is tc
and the second one is cmpui
. From the JSP page, I am trying to access .css
files, but it is giving me 404 error.
Location of JSP page is :
webapp\tc\layout\stylesheets.jsp
Location of CSS file is :
WEB-INF\css\default.css
Code on JSP page is
<link rel="stylesheet" type="text/css" href="../WEB-INF/css/default.css">
Any suggestion please.
Upvotes: 2
Views: 4761
Reputation: 1
You can not access a resources that are under WEB-INF
folder. Move your static resources to another place accessible by Struts2 (for example, web root). And use s:url
tag to build the URL.
<link rel="stylesheet" type="text/css" href="<s:url value='/css/default.css'/>">
Upvotes: 3