I’m trying to run this JSP code but it doesn’t work, I get HTTP Status 500. Why? Aren’t switch expressions supported? I do not want to use a switch statement, so please do not tell me to use this old version of the switch.
Note: this question is not a duplicate of if-else-in-jsp-switch-case which is about ==
vs .equals()
in relation to switch. This question is about the validity of the arrow ->
syntax in recent versions of JSP.
The code I’m trying to run:
</li>
<p>GENERE:
<%= switch(request.getParameter("genere")){
case "m" -> "Maschio";
case "f" -> "Femmina";
case "a" -> "Altro";
default -> "non selezionato";
}
%>
</p>
</li>
The error I get:
12