활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
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
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
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>
조회 수
답글
좋아요 수
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
조회 수
답글
좋아요 수
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>
조회 수
답글
좋아요 수
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/
조회 수
답글
좋아요 수