0

I have a spring controller which does a forward to a static html page index.html

The browser url display :

http://localhost:8080/app/type/static/name

Controller when gets this forwards:

return "forward:/static/pages/index.html";

The index page is located at:

webapp->static->pages->index.html

and the css is located at:

webapp->static->pages->css->style.css

when the url loads, it cant find the css file, looking in debugger

http://localhost:8080/app/type/static/pages/css/style.css

the url needs to be

http://localhost:8080/app/static/pages/css/style.css

I cant hard code this as the port can change? how can i do this?

user1555190
  • 2,803
  • 8
  • 47
  • 80

3 Answers3

1

appending this to href worked

../../

user1555190
  • 2,803
  • 8
  • 47
  • 80
0

Use in your head

<link href='css/style.css' rel='stylesheet' type='text/css'>
Dreamwalker
  • 3,032
  • 4
  • 30
  • 60
0

Or maybe :

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<link rel="stylesheet" type="text/css" href="<c:url value="/css/styles.css"/>">
Michel Z
  • 204
  • 4
  • 7