Top Head JSP Dynamic Includes

The top_head.jsp dynamic includes load additional links in the theme’s head. It uses the following keys:

Load additional links in the theme’s head before the existing ones:


Alternatively, you can load additional links in the theme’s head, after the existing ones:


The example below injects a link into the top of the top_head.jsp:

@Component(immediate = true, service = DynamicInclude.class)
public class CssTopHeadDynamicInclude extends BaseDynamicInclude {

	public void include(
			HttpServletRequest request, HttpServletResponse response,
			String key)
		throws IOException {

		PrintWriter printWriter = response.getWriter();

		String content = 
    "<link href=\"http://localhost:8080/o/my-custom-dynamic-include/css/mentions.css\" 
    type = \"text/css\" />";

	public void register(DynamicIncludeRegistry dynamicIncludeRegistry) {

Page Source:

  <link href="http://localhost:8080/o/my-custom-dynamic-include/css/mentions.css" rel="stylesheet" type="text/css">

Note that the link’s href attribute’s value /o/my-custom-dynamic-include/ is provided by the OSGi module’s Web-ContextPath (/my-custom-dynamic-include in the example).

Now you know how to use the top_head.jsp dynamic includes.

« WYSIWYG Editor Dynamic IncludesTop JS Dynamic Include »