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?

2
  • some HTML code may help to find your problem. Commented Dec 4, 2013 at 11:36
  • Some good solutions to this problem stackoverflow.com/questions/1483063/… Commented Dec 4, 2013 at 11:43

3 Answers 3

1

appending this to href worked

../../

Sign up to request clarification or add additional context in comments.

Comments

0

Use in your head

<link href='css/style.css' rel='stylesheet' type='text/css'>

2 Comments

no that doesnt work, it appends localhost:8080/app/type/static, how can get to the localhost:8080/app
Haha thought it said 'Use your head'
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"/>">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.