Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top