Bottom JSP Dynamic Includes

The bottom.jsp dynamic includes load additional HTML or scripts in the bottom of the theme’s body. The following keys are available:

Load additional HTML or scripts in the bottom of the theme’s body, before the existing ones:

/html/common/themes/bottom.jsp#pre

Alternatively, load HTML or scripts in the bottom of the theme’s body, after the existing ones:

/html/common/themes/bottom.jsp#post 

The example below includes an additional script for the Simulation panel in the bottom of the theme’s body, after the existing ones.

SimulationDeviceDynamicInclude Java class:

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

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

		PrintWriter printWriter = response.getWriter();

		printWriter.print(_TMPL_CONTENT);
	}

	@Override
	public void register(DynamicIncludeRegistry dynamicIncludeRegistry) {
		dynamicIncludeRegistry.register("/html/common/themes/bottom.jsp#post");
	}

	private static final String _TMPL_CONTENT = StringUtil.read(
		SimulationDeviceDynamicInclude.class,
		"/META-INF/resources/simulation_device_dynamic_include.tmpl");

}

simulation_device_dynamic_include.tmpl:

<script type="text/javascript">
	// <![CDATA[
		AUI().use(
			'aui-base',
			function(A) {
				var frameElement = window.frameElement;

				if (frameElement && frameElement.getAttribute('id') === 'simulationDeviceIframe') {
					A.getBody().addClass('lfr-has-simulation-panel');
				}
			}
		);
	// ]]>
</script>

When the Simulation panel is open, the script adds the lfr-has-simulation-panel class to the theme’s body.

Figure 1: You can use the bottom JSP dynamic include to inject scripts.

Figure 1: You can use the bottom JSP dynamic include to inject scripts.

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

Top Head JSP Dynamic Includes

Top JS Dynamic Include

WYSIWYG Editor Dynamic Includes

« Top JS Dynamic IncludeIntroduction to Service Builder »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0