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

落花浮王杯 提交于 2019-11-28 13:05:42

问题


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?

来源:https://stackoverflow.com/questions/27795529/untraceable-errors-in-xhtml-templates-caused-by-a-missing-space-between-attribut

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!