Grzegorz Adam Kowalski
Grzegorz Adam Kowalski

Reputation: 5575

Eclipse shows invalid character or invalid text string or tag not closed properly

Eclipse Neon.3 Release (4.6.3) reports error at this line of code:

<select id="<%=province.id%>" data-placeholder=" " <%=province.multiple%> class="chzn-select" style="margin: 1px auto;width:260px;">
</select>

Reported errors are:

Multiple annotations found at this line:
- Start tag (<select>) not closed properly, expected '>'.
- Invalid character used in text string (<%=province.multiple%> class="chzn-select" style="margin: 1px auto;width:260px;">).
- Invalid text string (<%=province.multiple%> class="chzn-select" style="margin: 1px auto;width:260px;">).

When I remove <%=province.multiple%> from the line, Eclipse stops reporting those errors, but as far as I know, this is valid code. What is wrong with it?

Upvotes: 0

Views: 5410

Answers (1)

pirho
pirho

Reputation: 12215

Should this

<select id="<%=province.id%>" data-placeholder=" " <%=province.multiple%> class="chzn-select" style="margin: 1px auto;width:260px;">

be (updated)

<select id="<%=province.id%>" data-placeholder=" " multiple="<%=province.multiple%>" class="chzn-select" style="margin: 1px auto;width:260px;">

Not necessary related in this case but found this also (see details here):

In XHTML, attribute minimization is forbidden, and the multiple attribute must be defined as input multiple="multiple"

Then the file suffix might also make Eclipse more critical: if it is .xhtml contents propably must be .xhtml.

One good - maybe not directly related - question: What is the difference between creating JSF pages with .jsp or .xhtml or .jsf extension

Upvotes: 1

Related Questions