| Author |
Message |
|
|
Post subject: Problems with JSP validation in 5.0M2
Posted: Aug 03, 2006 - 04:04 PM
|
|

Joined: Aug 23, 2005
Posts: 5
|
|
Hi,
I found a few problems with jsp & html validation going from eclipse 3.1, myeclipse 4.1 to eclipse 3.2, myeclipse 5.0M2
1) I cannot use anymore static jsp includes like <%@ include file="/WEB-INF/jsp/includes/myTable.jspf"%>
i get errors like
a) Syntax error on token "}", { expected
b) Syntax error, insert "Finally" to complete TryStatement
2) i cannot use anymore jstl tags inside html tags like
<input type="text" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"<c:if test="${status.error == true}"> class="error"</c:if>/>
i get a "undefined attribute name" warning on the jstl part (<c:if test="${status.error == true}"> class="error"</c:if>)
moreover, directories not included on the source path and not under WebRoot (actually including static html files, documentation, ...) are now parsed for errors
I also tried to disable jsp fragments validation with no results
Thx
PD |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 03, 2006 - 04:13 PM
|
|

Joined: Aug 23, 2005
Posts: 5
|
|
more info
a) the include errors are generated by the jsp validator
b) the warnings about jstl tags in html are generated by the html validator
if i disable those validators, i can work without false errors and warnings (but without validators ...) and the documentation dir is not parsed anymore by the html validator. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 03, 2006 - 10:45 PM
|
|
Veteran Member


Joined: Aug 19, 2004
Posts: 39
|
|
I've a feeling at least some of these may be genuine errors, from the validators point of view. I've had similar. Consider that a JSP is meant to be a genuine XML document, but most of the JSPs I've seen are not valid XML documents. For example, the construct:
<htmltag attr='<h:outputText value="${status.expression}"/>'/>
is not a valid XML line. It would need to be:
<f:verbatim><htmltag attr='</f:verbatim><h:outputText value="${status.expression}"/><f:verbatim>'/></f:verbatim>
For completness, you might even want to change the literal ">" character to ">" giving:
<f:verbatim><htmltag attr='</f:verbatim><h:outputText value="${status.expression}"/><f:verbatim>'/></f:verbatim>
Of course, this makes the JSP very ugly but I can't see a way round it, for true validation. I'm going to look for or start a thread on this.
See page 16 of the "Core JavaServer Faces" book, for a brief discussion of this topic.
Tony |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 03, 2006 - 10:53 PM
|
|

Joined: Aug 23, 2005
Posts: 5
|
|
ghosh !
you turned on my brain !!
i have the feeling that you are, in some way, right.
May be i have never been thinking to your points because
1) too many years using inner tags in html and "non-xml jsp includes"
2) the previous validator version validated it and i "mechanically" started thinking to bugs in the new validator
but, if you are right, your considerations are worth of a different, and much more interesting, thread !!
however i still have some doubts ... it is true that my jsp pages are declared
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
but ... why is the html validator giving errors about non compliant html even when parsing jsp documents ?
moreover, why is the jsp validator asking for correct xml pages (it this is the correct diagnosis) , giving errors on non-xml includes ?
you say that "Consider that a JSP is meant to be a genuine XML document". are you sure ? is it a 2.4 spec ? actually it is he first time that i read this.
and if you are right, it means that the <%@ directive syntax cannot be used any more. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 04, 2006 - 03:30 AM
|
|
Veteran Member


Joined: Aug 19, 2004
Posts: 39
|
|
Thinking about it, it may be that a JSP does not need to be an XML document. However, it is also not usually an XHTML document, as the <!DOCTYPE> declaration would indicate. Rather, an XHTML document is what is aimed to be produced by the JSP. This might be at least part of the issue.
If the document starts with an <?xml?> declaration, then it should be an XML document.
One question is: should the editors and validators be tolerant of "bad" JSP documents or should they insist that the rules be met?
Tony |
|
|
| |
|
|
|
 |
|
|
|