Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mvc-dev] Static Content with MVC

Hi all,

AFAIK the issue is actually the empty application path. Depending on the JAX-RS implementation you are using, this is handled correctly. With an empty application path, ALL requests are intercepted by the JAX-RS implementation and as there is no JAX-RS resource for the requested URL, you will get a 404.

Typically, we recommend using a non-empty application path. However, this will add an extra path segment to your MVC URLs.

But maybe there are other ways to fix this I'm not aware of. To sum up, this is actually a JAX-RS and not an MVC issue.

Christian

Am Fr., 3. Juli 2020 um 08:18 Uhr schrieb Ivar Grimstad <ivar.grimstad@xxxxxxxxxxxxxxxxxxxxxx>:
Hi Victor,

Try this in your main.xhtml file:

<link rel="stylesheet" type="text/css" href="${mvc.contextPath}/assets/css/main.css" />

Ivar

On Fri, Jul 3, 2020 at 3:52 AM Victor Perticarrari <victor.perticarrari@xxxxxxxxx> wrote:

I'm trying to create an example using MVC 1.0.


It is working for all views, but not for static content. I have a simple Hello World with the error here: https://github.com/vepo/java-mvc-hello-world


If I execute it, I get 404 on /assets/css/main.css


Is something missing?


Thanks,

--
Victor Osório
_______________________________________________
mvc-dev mailing list
mvc-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mvc-dev


--

Ivar Grimstad

Jakarta EE Developer Advocate | Eclipse Foundation, Inc.

Community. Code. Collaboration. 

Join us at our virtual event:
EclipseCon 2020 - October 20-22

_______________________________________________
mvc-dev mailing list
mvc-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mvc-dev


--

Back to the top