0

I'm writing simple web app which generates simple CSS file for user.

I've mapped servlet for writing CSS on specific tag, and depending of the user's session attributes, I use PrintWriter for generating CSS stylesheet.

Problem: Stylesheet doesn't have any effect. Chrone shows it was downloaded (inspect element -> network), but it doesn't have any effect on my htmlpage.

In html, CSS is defined by: <link href="stylesheet.css" rel="stylesheet" type='text/css'>.

1 Answer 1

1

That will happen if the response content type is (implicitly) set to something else than text/css. You can easily verify it in response headers section in HTTP traffic monitor.

Explicitly set it before writing any byte to the response body.

response.setContentType("text/css");
// ...
Sign up to request clarification or add additional context in comments.

1 Comment

Thanx, that solved the problem! I totally forgot about that. :)

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.