For example, in jstl the switch statement like below
<c:choose><c:when test="${salary <= 0}"> Salary is very low to survive.</c:when><c:when test="${salary > 1000}"> Salary is very good.</c:when><c:otherwise>No comment sir...</c:otherwise></c:choose>
Need to convert the above switch statement to sightly. Please help me in this
Solved! Go to Solution.
Views
Replies
Total Likes
Try the following code-
<div data-sly-test="${salary < 0}" data-sly-unwrap> Salary is very low to survive </div> <div data-sly-test="${salary > 1000}" data-sly-unwrap> Salary is very good. </div> <div data-sly-test="${salary < 1000} && ${salary > 0}" data-sly-unwrap> No comment sir... </div>
Views
Replies
Total Likes
All of these conditional changes, you should be doing in a simple POJO. It is better, If You should avoid such logic at the template level.
Jitendra
Rama Krishna wrote...
For example, in
the switch statement like below jstl
Need to convert the above switch statement to sightly. Please help me
this in
Views
Replies
Total Likes
Try the following code-
<div data-sly-test="${salary < 0}" data-sly-unwrap> Salary is very low to survive </div> <div data-sly-test="${salary > 1000}" data-sly-unwrap> Salary is very good. </div> <div data-sly-test="${salary < 1000} && ${salary > 0}" data-sly-unwrap> No comment sir... </div>
Views
Replies
Total Likes
Hi Rama,
Approach I could suggest is, you can write this in sightly JS ( executes in server side) file as it supports switch. Take a look at this article on how you can us JS code sightly http://adobeaemclub.com/javascript-use-api-with-a-simple-component-in-sightly/
Views
Replies
Total Likes