Expand my Community achievements bar.

SOLVED

Issues with resolving taglibs in JSP based component

Avatar

Level 4

Hello Community - Since my previous request was marked as resolved so I am opening this to get an assistance here. Please note that I am using JSP based component not HTL. This is a very simple component which takes the taglib from the dialog and inject the respective tags for the provided taglib. If I simply hardcoded the taglib directly in the component it works fine and I could see the expected results but it doesn't work when I provide the taglib via dialog. Not sure what is causing the issue. Any help on this is highly appreciated.

SS1.PNG

component.jsp:

<%@include file="/libs/foundation/global.jsp" %>
<%@page import="com.day.cq.wcm.api.WCMMode"%>
<%@ taglib uri="http://company.com/clientLib-taglib" prefix="evaltag" %>

<% if((WCMMode.fromRequest(request) != WCMMode.DISABLED)) { %>
Taglib Component
<%} %>

${properties.openhtml}


This is what I author from the dialog:

<evaltag:includeClientLibs async="true" defer="false" js="clientlib" verName="${projectVersion}" />

 

@BrianKasingli @Vijayalakshmi_S

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @aemninja,

Can you try like the below. If it is not working, share your complete JSP if possible. Also share the node structure of how this particular field is saved (property value from respective node)

<%
String openHtml = properties.get("openhtml", ""); // provided openhtml dialog field/content authored is saved as String
%>
<%= openHtml %>

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @aemninja,

Can you try like the below. If it is not working, share your complete JSP if possible. Also share the node structure of how this particular field is saved (property value from respective node)

<%
String openHtml = properties.get("openhtml", ""); // provided openhtml dialog field/content authored is saved as String
%>
<%= openHtml %>

Avatar

Level 4
@Vijayalakshmi_S - Thanks for your reply. I have tried with the below but the tags are still not resolving and the author taglibs are present as is. PFB. <%@include file="/libs/foundation/global.jsp" %> <%@page import="com.day.cq.wcm.api.WCMMode"%> <%@ taglib uri="http://company.com/clientLib-taglib" prefix="evaltag" %> <% if((WCMMode.fromRequest(request) != WCMMode.DISABLED)) { %> Taglibs <%} %> <% String openHtml = properties.get("openhtml", ""); %> <%= openHtml %>

Avatar

Level 4
@Vijayalakshmi_S - I have added the screenshot of the node structure in the initial section.

Avatar

Level 4
@Vijayalakshmi_S - Could you please let me know if you are able to replicate the issue at your end?

Avatar

Community Advisor

Hi @aemninja,

Sorry, I missed this thread.

I tried and looks like we can't input JSTL tags via dialog field. In your case, it has dynamic variable too as part of the tag - verName (Even if we don't have one, it wont work)

Should be related to the way the JSTL tags are processed as the component is executed.

The snippet I shared will work for normal HTML tags (You can give a try by adding some html tag like h2 and see it working)