Reputation: 197
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'>
.
Upvotes: 0
Views: 62
Reputation: 1108782
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");
// ...
Upvotes: 1