Hi I have discovered that when i start tomcat it is trying to validate my struts-config.xml against a dtd on the web instead of the local copy i have in my web-inf folder, is this a bug or is there a reason for this? Kola
That's the standard XML parser behavior. You can change the DOCTYPE directive to point somewhere else. For example: <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "struts-config_1_1.dtd" >
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
David Thanks for the reply. As i understood it, the struts.jar was supposed to be the first place it checked. I actually removed the whole dtd section leaving in only the xml declaration and it worked could this have any adverse results?
Joined: Dec 19, 2002
Originally posted by k Oyedeji: As i understood it, the struts.jar was supposed to be the first place it checked. I actually removed the whole dtd section leaving in only the xml declaration and it worked could this have any adverse results?
Like I say, this is standard XML parser behavior. It looks for the DTD at the URL provided in the DOCTYPE. The risk associated with it is that no validation can be done other than "well-formedness" on your config file. The result is that (some) errors in your config cannot be caught until they are encountered at runtime. Misspelled attribute names would be a particular issue. Consider, for example, <forward ndme="notFound" path="/notFound.dhtml" /> Do you see the error? The validator would, and would complain quite loudly! On the other hand, you wouldn't see it at runtime until you would encounter your "notFound" forward, which might be a niche case of a niche action. So some user somewhere ends up staring at the infamous "white screen" symptomatic of a misconfiguration in struts.