Untraceable errors in XHTML templates caused by a missing space between attributes among (X)HTML tags
Asked Answered
I

0

0

Have a simple question. Let's consider the following tag.

<h:inputText id="text" value="#{bean.value}"/>

If it is mistakenly written as follows.

<h:inputText id="text"value="#{bean.value}"/>

Please notice that there is no space between the id and the value attributes in this case. This is expected to be a parse error that should occur during parsing of the XHTML file possibly throwing an appropriate exception.

If it were to happen, absolutely nothing exceptional would be reported. No errors/exceptions would be thrown on the server-side. The target web page on the browser would then merely be left blank (white) in its entirely which would also indicate no errors as obvious on the client-side, since parsing of the file happens on the server-side.


Additional Information :

This already happened to me several times on XHTML files having several lines of code even though extreme care is exercised/taken. Mostly happens during copy/pasting which is many a times essential.

If it were to happen, the only way to trace the error was scan the XHTML document manually starting from the first line, all the way down to the last line (or the trace line, if one is caught) possibly scrolling in the middle through a long, ugly horizontal scroll bar on the IDE's GUI too.

Fortunately, I duplicated the same application twice - once using Java EE and again using Spring hereby XHTML code was same in both of the projects. I had been solving this problem as of now, since I began those applications in parallel by copy/pasting the whole XHTML code from one project to another, when it happened and I was unable to trace the line by average attempts. This is not always an alternative.


Can it get to throw an exception, when an XHTML document is mal-formed in this way? Are there someways to make it debuggable/traceable so that one can get rid of manual/tedious/time-consuming/eye-stretching tracing of an XHTML document?

Izak answered 6/1, 2015 at 9:19 Comment(6)
Which JSF impl/version? In Mojarra 2.2.8 I get during runtime Caused by: javax.faces.view.facelets.FaceletException: Error Parsing /test.xhtml: Error Traced[line: 25] Element type "h:inputText" must be followed by either attribute specifications, ">" or "/>". at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:456)Inclinatory
Currently it is JSF 2.2.8-02 but it is not restricted to this version only. It has been happening for a long time (perhaps since I started learning JSF, if I can remember correctly). Thus, the application(s) has passed through several JSF versions so far. (can this be related to the IDE - NetBeans? It should not).Izak
Should indeed not be IDE related. Eclipse didn't warn me about that too, but I do get this exception during runtime when just opening the page by GET.Inclinatory
I got the same exception on a playground project with the same version of JSF (with(out) PrimeFaces). Therefore, the problem is only restricted to the real application lurking somewhere in it.Izak
Custom view handler? Custom exception handler?Inclinatory
There was only one : org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory. Tried removing it. Nothing new happened.Izak

© 2022 - 2024 — McMap. All rights reserved.