[ 
https://issues.apache.org/jira/browse/SLING-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13660112#comment-13660112
 ] 

Alexander Klimetschek commented on SLING-1500:
----------------------------------------------

The most useful one is missing - getting a value or a default, if the value is 
null. Especially for the ValueMap. While you can do ${properties.foo} which 
will do properties.get("foo") if properties is a (Value)Map, you are missing 
out on the extremely useful ValueMap#get(name, default).

Something like this:

${sling:get(properties.foo, "default")}

Good name is welcome. Nice would be an "elvis" operator in EL, such as ?: 
(groovy), || (ruby) or ?? (C#):

${properties.foo ?: "default"}

But that would require to extend the EL parser/evaluator (javax.el) in the 
sling JSP scripting language.
                
> Patch Submission: Expression Language (EL) Functions for JSP Taglib
> -------------------------------------------------------------------
>
>                 Key: SLING-1500
>                 URL: https://issues.apache.org/jira/browse/SLING-1500
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>    Affects Versions: Scripting JSP-Taglib 2.0.6
>            Reporter: Mark Adamcin
>            Assignee: Dan Klco
>            Priority: Minor
>              Labels: el, function, jsp, scripting, sling, taglib
>         Attachments: add-files.zip, SLING-1500.diff, taglib11.tld.patch
>
>
> I've noticed that the Sling Resource API is not very accessible for tag- and 
> EL-focused JSP development. In order to promote readable JSP code, I created 
> a set of static methods to implement commonly-used ResourceResolver methods 
> as well as to expose the rather useful ResourceUtil methods as EL functions. 
> The functions use ResourceWrappers to work around the isse 
> https://issues.apache.org/jira/browse/SLING-1414 where the Resource.getPath() 
> method is inaccessible in EL for JcrNodeResource objects.
> I've found these taglib functions to be very useful for Day CQ5 development, 
> so I thought I'd offer to contribute them to the project.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to