0

I have a website that I've deployed to TomEE and it works if I deploy it as ROOT.war.

However, I need to deploy it to its own directory. When I do that, it can't find any css, js or other files.

The following works when I deploy as ROOT.war:

<link rel="stylesheet" type="text/css" href="/css/mystyles.css" />

But no css, js or other files can be accessed if I deploy to any other directory.

The server thinks that the css directory is always under the ROOT webapp and nothing I have tried will link the site to css, js or any other files.

Some comments I found online indicated that I need to use JSTL.

Here is what I have in my web.xml file:

<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee web-app_6_0.xsd"
        version="6.0">

In my index.jsp file I put:

<%@ taglib uri="jakarta.tags.core" prefix="c" %>

But when I try to bring up the site, I get:

Unable to find taglib [c] for URI: [jakarta.tags.core]

Do I really need JSTL just to link a css file for a site that was not deployed as ROOT.war? How do people link to css and js files in their Java webapps?

I am using TomEE 9.0.0, Java 17 and Ant 1.10.12.

Zephyrus
  • 121
  • 2
  • JSTL is not required. See 1st duplicate how to solve it using plain EL. TomEE 9 is not a Jakarta EE 10 server but a Jakarta EE 9 server. Thus it doesn't ship with JSTL 3.0 but still with JSTL 2.0. In other words, you still need the old taglib URI associated with JSTL 2.0. See 2nd duplicate. – BalusC Feb 22 '23 at 20:30

0 Answers0