I have the following errors in (just) one of the dozens *.jsp
files we have in our project:
line 0 in a text editor is somehow funny, but OK, we devs often start to count there. Does this refer to the small red square top-right (which says "Errors: 8" on hover, BTW)?
<tr>
<td>Status</td>
<td>
<select name="oid_status">
<!-- Warning here --> <c:forEach
<!-- This is L115 --> items='${
[
["0", "---Bitte wählen---"],
["active", "aktiv"],
["assigned", "zugewiesen"],
["retired", "zurückgestellt"],
["invalid", "ungültig"]
]
}'
var="option"
>
<option
value="${option[0]}"
${searchCriteria.status() eq option[0] ? "selected" : ""}
>${option[1]}</option>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td>Kategorie</td>
<td>
<select name="oid_category">
<!-- Warning here --><c:forEach
<!-- This is L161 --> items='${
[
["0", "---Bitte wählen---"],
["alias", "Alias (alias)"],
["other", "Andere (other)"],
["document", "Dokument (document)"],
["experimental", "Experimentell (experimental)"],
["external", "Extern (external)"],
["identificationscheme", "Identifikationsschema (identificationscheme)"],
["instance-identifier", "Instanz Identifikator (instance-identifier)"],
["codingscheme", "Kodierschema (codingscheme)"],
["organization", "Organization (organization)"],
["person", "Person (person)"],
["policy", "Richtlinie (policy)"],
["service", "Service (service)"],
["template", "Vorlage (template)"],
["valueset", "Value Set (valueset)"]
]
}'
var="option"
>
<option
value="${option[0]}"
${searchCriteria.category() eq option[0] ? "selected" : "" }
>${option[1]}</option>
</c:forEach>
</select>
</td>
</tr>
It's consistently wrong, at least. These are the only such constructs in the file.
I updated the (Maven) project dozens of times. I cleaned the project (with both Eclipse ➔ Project ➔ Clean... and mvn clean
). I -clean
ed the workspace on Eclipse's startup. I even created a new workspace, abandoned the old one and imported all projects newly. I also performed a few Eclipse updates already since this occurred. All to no avail. I have a colleague who knows much more about JSP than me, but even he has no idea. And yes, every (Maven) build succeeds and the webapp runs without issues (apart from usual dev or environment hickups).
As I said in the commentarie the JSP syntax is constantly wrong. The errors are correct.
<c:forEach
<!-- This is L161 --> items='${
This is already wrong, because you cannot use comments in the JSP tags.
Then for items
attribute the iterable object is expected, but [
is found in the JSP expression.
For some languages like OGNL the JSP editor sometimes fails to validate a syntax. This is not only Eclipse editor but IntelliJ IDEA also fails because it's impossible to correctly validate the unknown language for JSP editor. At runtime no error happens, since that always turned off JSP syntax checker. But this is not your case.