Create or Update JSP Tags

Create or update JSP tags to encapsulate JSP logic used across multiple pages.

Best Practice Guidelines

SAP recommends these guidelines for software developers extending SAP Commerce Cloud.

Apply spring:htmlEscape in the code of JSP tags
If a JSP defines spring:htmlEscape, it does not seem to be propagated to the tags used within that JSP. Therefore, ensure spring:htmlEscape is also included in tag files so that affects the tag's logic. Use it in tag files in the same way as it is in JSP files. The following displays a compliant example:
<%@ taglib ... %>
<%@ taglib ... %>
<%@ attribute ... %>
<%@ attribute ... %>
<spring:htmlEscape defaultHtmlEscape= "true"/>
  
  
<spring:url ... htmlEscape= "false"/>
When page or app level defaultHtmlEscape="true" is used, beware of tricky situations that can lead to double encoding. As an example, there can be cases such as this some.jsp...
<%@ taglib ... %>
<spring:htmlEscape defaultHtmlEscape= "true"/>
...
<spring:theme code= "text.company.select.action.label" text= "Select" var= "selectAction"/>
  
...
  
${selectAction}
… .where it is tempting to use fn:excapeXml on ${selectAction}. However, doing so will result in double encoding.