Hi,
I have to check if a specific attribute(variable) of the bean class to some constants in a
JSP file. So i am using mulitple if and else-if conditions blocks to display a label accordingly. Instead of having multiple if-else blocks, i am looking for other options to perform this operation effectively in JSP. Below is one approach which i have found so far,
1) Create long array constant with all the values.
2) In JSP, convert this array to an ArrayList using Arrays.asList(Test.SPEC_TYPES)
3) In JSP, get the attribute from the
java bean and check if ArrayList contains it.
Please suggest if the above approach if good or bad. Also please clarify if i can proceed with the if-else conditional block method or any other good practice. Thanks.