JSTL is great for eliminating scriptlets in your JSPs. The standard JSTL tags are designed to be general purpose, applicable and useful in many different applications. But frequently you need to create your own custom tags to meet the needs of your specifc application. To really take advantage of the JSTL you need to make your custom tags work in conjuction with the JSTL. For instance, you may want to use the ‘forEach’ tag provided by the JSTL and have your custom tag nested inside the forEach loop. Inside the loop you want to have your tag interact with the variable that is exposed by the ‘var’ attribute of the forEach tag. You can accomplish this by giving your custom tag the ability to evaluate expressions written in the JSTL’s expression language.
If you are working with JSP 2.0, the expression language is part of the servlet specification and you can find the classes for evaluating expressions in the
If you haven’t stepped up to JSP 2.0 yet and you’re working with JSTL 1.0 you can use the
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager class found in the Jakarta taglibs standard.jar file.