[MAGNOLIA-5745] Revise compatibility of JspTemplatingFunction and TemplatingFunctions Created: 14/Apr/14  Updated: 25/Apr/14  Resolved: 25/Apr/14

Status: Closed
Project: Magnolia
Component/s: taglibs, templating
Affects Version/s: 4.5.17, 5.2.3
Fix Version/s: 4.5.19, 5.2.5

Type: Bug Priority: Neutral
Reporter: Roman Kovařík Assignee: Eric Hechinger
Resolution: Won't Fix Votes: 0
Labels: maintenance, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
causality
caused by MAGNOLIA-5668 Make use of JspTemplatingFunction for... Closed
relation
is related to MGNLMIGRATION-318 Add code changes for JSP's during mig... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

MAGNOLIA-5668 introduced usage of info.magnolia.templating.jsp.cmsfn.JspTemplatingFunction instead of info.magnolia.templating.functions.TemplatingFunctions in JSP renderer.

JspTemplatingFunction have static method, e.g.
public static boolean JspTemplatingFunction .isEditMode()
vs
public boolean TemplatingFunction.isEditMode()

which is probably the cause of this issue:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.0"
          xmlns:jsp="http://java.sun.com/JSP/Page"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xmlns:cmsc="cms-custom-taglib"
          xmlns:cms="http://magnolia-cms.com/taglib/templating-components/cms"
          xmlns:cmsfn="http://magnolia-cms.com/taglib/templating-components/cmsfn">

[..]

<c:when test="${cmsfn.editMode}">

this now fails with:

Caused by: javax.el.PropertyNotFoundException: The class 'info.magnolia.templating.jsp.cmsfn.JspTemplatingFunction' does not have the property 'editMode'.
	at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:722)
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:351)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
	at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
	at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
	at org.apache.jasper.runtime.PageContextImpl.evaluateExpression(PageContextImpl.java:1009)
	at org.apache.jsp.templates.vanlanschot.templates.master_002dtemplate_jsp._jspx_meth_c_when_4(master_002dtemplate_jsp.java:895)

For detail, see http://jira.magnolia-cms.com/browse/SUPPORT-3242?focusedCommentId=82829&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-82829.
Investigate possibility of extending JspTemplatingFunction from TemplatingFunction.



 Comments   
Comment by Eric Hechinger [ 25/Apr/14 ]

As 4.5 introduces JSP's function (JspTemplatingFunctions) there is no way to get rid of the parentheses.
Currently, the following 4.4 call have to be manually rewritten:

  • cmsfn.editMode to cmsfn.isEditMode()
  • cmsfn.authorInstance to cmsfn.isAuthorInstance()
  • cmsfn.fromCurrentPage to cmsfn.isFromCurrentPage()
  • cmsfn.inherited to cmsfn.isInherited()
  • cmsfn.previewMode to cmsfn.isPreviewMode()
  • cmsfn.publicInstance to cmsfn.isPublicInstance()

The migration process will be enhanced in order to automatically add this step (MGNLMIGRATION-318) and should be part of the 4.5.19 release.

Generated at Mon Feb 12 04:08:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.