0

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

sam
  • 3,441
  • 2
  • 33
  • 42

1 Answers1

1

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.

Community
  • 1
  • 1
fvu
  • 32,488
  • 6
  • 61
  • 79
  • Ok, I understand. I forgot that a JSP is no more than a servlet at the end,so it's perfectly normal that the "goto" keyword as a variable name would provoke an error. Thank you. – sam Aug 02 '13 at 15:02