I'm working on an old JSP project, and I have an issue where I have a Java file that has some static strings, and I want to pull those strings into a JSP file for usage.
In the Java file:
package path.path1.path2
public interface MyJavaStrings
{
public static final FIRST_NAME = "Joe";
public static final LAST_NAME = "Smith";
}
And then the JSP looks something like this:
<%@ page import = "path.path1.path2.MyJavaStrings" %>
<%@ taglib uri="jstl-core" prefix="c" %>
<%
String firstName = MyJavaStrings.FIRST_NAME;
String lastName = MyJavaStrings.LAST_NAME;
%>
<script>
console.log(<%=firstName %>);
</script>
That's the overall approach I'm taking, but whenever I look at the console, it seems as if it's just logging nothing, so no value got passed in, but it isn't failing either. Is there a different approach to take?