1

How can I retrieve the values in JSP by passing the key for localization. I can see the core.json file under the publication where the key/value pair is defined.

I am using the method getResource and getConfiguration of Localization like

localization.getResource("core.keyName")

but not getting any value. I have configured Publication in cd_dynamic xml file and added the path like /app/dm/ Is any other configuration required?

<jsp:useBean id="markup" 
             type="com.sdl.webapp.common.markup.Markup" scope="request" />
<jsp:useBean id="localization" 
             type="com.sdl.webapp.common.api.localization.Localization" scope="request" />
<jsp:useBean id="pageModel" 
             type="com.sdl.webapp.common.api.model.PageModel" scope="request" />

<%
    String specialOfferText1  = localization.getConfiguration("core.ccSpecialOfferText");  
    System.out.println("Special Offer for Localization ::: "+localization.getId());
    request.setAttribute("specialOfferText", specialOfferText1);
    System.out.println("Special Offer for Localization ::: "
                                              +request.getAttribute("specialOfferText"));

    pageContext.setAttribute("specialOfferText",specialOfferText1);
%>
  • 2
    Can you show your View code which is trying to access configuration? – Rick Pannekoek Dec 4 '16 at 9:03
  • View code looks alright. What about the CM-side? Did you put your configuration in the Core config Component? Did you publish the Publish Settings Page? Dou you see your config setting in you Web App in BinaryData/{pubid}/system/config/core.json? – Rick Pannekoek Dec 7 '16 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.