aspose file tools*
The moose likes Struts and the fly likes Possible struts bug? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Possible struts bug?" Watch "Possible struts bug?" New topic
Author

Possible struts bug?

KOla Oyedeji
Greenhorn

Joined: Aug 28, 2001
Posts: 20
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
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
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.
k Oyedeji
Ranch Hand

Joined: Jul 07, 2002
Posts: 96
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?
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible struts bug?
 
Similar Threads
How can Jbuilder8 run Struts1.1
Strength and weakness of Struts
Check null value question?
Ajax and web frameworks
Cannot retrieve mapping for action