Skip to main content
3 of 3
added 36 characters in body
Bart Koopman
  • 29.6k
  • 3
  • 40
  • 90

How to use JAVA contants in JSP for DXA 1.5

File 1 : Constants.java

package com.sdl.webapp.main.common;


public class Constants {
    public static final String LARGE = "Large";
}

File 2 : demo.jsp

<jsp:useBean id="entity" type="com.sdl.modules.model.common.GenericComponentCollectionModel" scope="request"/>
<jsp:useBean id="cons" type="com.sdl.webapp.main.common.Constants" scope="request"/>

${cons.LARGE}

[3/21/17 11:53:24:125 EDT] 00000076 SystemOut O 11:53:24.122 [WebContainer : 2] ERROR c.s.w.c.impl.taglib.dxa.EntitiesTag - Error while processing entities tag com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.InstantiationException: bean cons not found within scope

How do I handle String constants in JSP in the DXA framework ?

We are using the Java MVC framework, DXA 1.5 and SDL Tridion 2013