0

I had to update the taglibs version (due to project requirement) from 1.1.2 to 1.2.5. After this update, while running UI I am getting this error:

javax.servlet.jsp.JspTagException: Illegal use of <when>-style tag without <choose> as its direct parent.

I tried debugging the same code on earlier version of taglibs vs the one I am trying to move to. For both of them, I am getting the identical values for parent tag i.e. ChooseTag. This is the code snippet for which I am getting this error

       <c:choose>
            <c:when test="${somecondition}">
                return;
            </c:when>              
       </c:choose>       

taglibs condition failing is as follows:

 if (!((parent = this.getParent()) instanceof ChooseTag)) {
            throw new JspTagException(Resources.getMessage("WHEN_OUTSIDE_CHOOSE"));
        }

value of 'this' in debug mode for upgraded version: Inspect result of 'this' in debug mode I am new to JSP, so apologies in advance if I am missing something which should be obvious.

Nikhil
  • 1
  • 2
  • `return;` is meaningless in this JSP - have a look at https://stackoverflow.com/questions/9004906/jstl-choose-when to see how to use `choose` – Scary Wombat Jun 07 '23 at 07:37
  • This can happen when you have multiple occurrences of ChooseTag.class in runtime classpath and the instanceof comparison was done against the wrong one. In other words, you have duplicate different versioned JSTL libraries in runtime classpath. Apparently upgrade is done wrong and you forgot to remove one or more old libraries. You can find proper instructions in top rated answer of abovelinked duplicate. – BalusC Jun 07 '23 at 12:03

0 Answers0