JSP Example Code
controller/controller.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%-- create the map that will contain relevant field values --%> <jsp:useBean id="helloworld" type="java.util.Map" scope="request"/> <%-- access the fields that affect all views--%> <c:set target="${helloworld}" property="styleClass" value="helloworld"/>
controller/default.jsp
<%-- Needs to be here but can be kept empty --%>
controller/custom.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%--declare the map that will contain relevant field values --%> <jsp:useBean id="helloworld" type="java.util.Map" scope="request" /> <c:set target="${helloworld}" property="customText" value="${fn:trim(element.content.fields.customText.value)}"/>
view/default.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%--declare the map that will contain relevant field values --%> <jsp:useBean id="helloworld" type="java.util.Map" scope="request" /> <div class="${helloworld['styleClass']}"> Hello world! </div>
view/custom.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%--declare the map that will contain relevant field values --%> <jsp:useBean id="helloworld" type="java.util.Map" scope="request" /> <div class="${helloworld['styleClass']}"> <c:out value="${helloworld['customText']}"/> <input type="button" id="btnHello" value="Click Me" onclick="printHello('${helloworld['customText']}')" /> </div>