in Education by
This question already has answers here: How to reference constants in EL? (12 answers) Closed 6 years ago. I have a class that defines the names of various constants, e.g. class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } I would like to use these constants within a JSP without using Scriptlet code such as: <%@ page import="com.example.Constants" %> <%= Constants.ATTR_CURRENT_USER %> There appears to be a tag in the Apache unstandard taglib that provides this functionality. However, I cannot find any way to download this taglib. I'm beginning to wonder if it's been deprecated and the functionality has been moved to another (Apache) tag library? Does anyone know where I can get this library, or if it's not available, if there's some other way I can access constants in a JSP without using scriptlet code? Cheers, Don JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
On application startup, you can add the Constants class to the servletContext and then access it in any jsp page servletContext.setAttribute("Constants", com.example.Constants); and then access it in a jsp page (you might have to create getters for each constant)

Related questions

0 votes
    This question already has answers here: How to reference constants in EL? (12 answers) Closed 6 years ago ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    Java code is embedded under which tag in JSP? (a) Declaration (b) Scriptlet (c) Expression (d) Comment This ... JSP & API of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Java code is embedded under which tag in JSP? (a) Declaration (b) Scriptlet (c) Expression (d) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    What programming language(s) or scripting language(s) does Java Server Pages (JSP) support? (a) ... JSP topic in section Database Programming Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    This question already has answers here: converting date format (5 answers) Closed 5 years ago. I have a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: CountDownLatch vs. Semaphore (7 answers) Closed 5 years ago. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I am trying to use design support library. Gradle dependencies are as follows dependencies { compile 'com. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: CountDownLatch vs. Semaphore (7 answers) Closed 5 years ago. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: CountDownLatch vs. Semaphore (7 answers) Closed 5 years ago. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I am trying to use design support library. Gradle dependencies are as follows dependencies { compile 'com. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: CountDownLatch vs. Semaphore (7 answers) Closed 5 years ago. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Saving path in String (4 answers) Closed 5 years ago. I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Saving path in String (4 answers) Closed 5 years ago. I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to deal with "java.lang.OutOfMemoryError: Java heap space" error ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    I am trying to use design support library. Gradle dependencies are as follows dependencies { compile 'com. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
...