I inherited a JSP that uses switch / case logic based on a single
character that was picked up by a getAttribute method.
String mainInfo = (String)request.getAttribute("MAININFO");
char info = mainInfo.charAt(0);
switch(info) {
case 'A':
break;
case 'B':
break;
...etc...
}
The characters ('A', 'B', etc) in themselves aren't meaningful to the function of the JSP. I'd like to replace the single character with a string
that would be more meaningful.
From what I've been able to read, I could contain all the possible string
values using the enum class, but I've looked at the examples until I'm
cross-eyed, and I can't figure out how I would incorporate it into a JSP.
How & where would I define the enum class so I could essentially do this?:
String mainInfo = (String)request.getAttribute("MAININFO");
switch(mainInfo) {
case CASEA:
break;
case CASEB:
break;
...etc...
}
TIA.