jspf header:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<title>Serendipity Book Shop</title>
</head>
Partial jsp code:
<div id="indexLeftColumn">
<div class="categoryBox">
<a href="#"><span class="categoryLabelText">Science Fiction</span></a>
</div>
...
</div>
I would like to split assets/css/style.css and create partial css and include it as css blocks into their respective html files.
In Django I used to do:
{% block css %} ... {% endblock %}
The only way that I found is to use style inside the html body:
<style> ... </style>
Is there a better way doing it?
As reported in some comments it would be advised to have multiple CSS files, chunks of assets/css/style.css, and include the ones you want into your JSP files.
Otherwise, I can recommend using Apache Tiles which is a templating framework that let you define multiple layouts for different JSP files including multiple assets. It will be up to you to choose how to decouple and manage your layouts.
Even though this framework is not handled within a great community and have slightly pure examples for advanced topics but you can easilly get your self out with a good template when it comes to some basic layout.