Question

Today I was just coding some Jspx page using Spring framework and an error appared that I didn't understand because I had just copy past the same several time and it was working perfectly with just the original line. It seems that the following lines were unusable :

<spring:url var="goto" value="/resources/images/goto16.png" />

<img alt="goto" src="${goto}"/>

But if I change the name "goto" to anything else, "got" for instance, then it woks fine !

I guess that this word is protected because used for another purpose, but I didn't find a clue about this problem on the net.

Does anyone know something about this matter ? I don't really need "goto" but I would like to know why I can't use it.

Thanks

Was it helpful?

Solution

goto is a reserved word in Java, and as JSP's are translated into Java source code the variable name will appear somewhere in that code, causing the compilation issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top