PATH  WebObjects 4.0 Documentation > What's New in WebObjects 4.0

Table of Contents Previous Section

Troubleshooting WebObjects 4.0 Template Parsing

The WebObjects template parser parses the HTML that is to be included in a response. In WebObjects 4.0, the template parser preserves all of the static HTML that you provide in a component's template. Previously, the parser recognized many HTML tags and performed special processing based on the type of tag. The 4.0 template parser ignores all tags besides <WEBOBJECT> and HTML comment tags.

The new parser has several advantages:

A WebObjects application may unknowingly depend upon the previous behavior of the template parser. For this reason, a compatibility flag is available on WOApplication to revert to the previous behavior.

Usually when 4.0 template parsing produces an error, it is because you have included a WebObjects dynamic form element inside of a static HTML FORM element. Change the FORM element to a WOForm, and your component should operate normally again. An error may also arise if your HTML pages contain BODY or IMG tags with src parameters containing relative pathnames (absolute pathnames aren't a problem). Change the affected tags to WOBody and WOImage, respectively.

If you want, you can go back to the previous parser by implementing this method in your application class (shown in Java and WebScript):

public boolean requiresWOF35TemplateParser() {
	return true;
}
- requiresWOF35TemplateParser {
	return YES;
}
If you use the WebObjects 4.0 template parser, you might want to suppress the inclusion of HTML comments. Use the following methods, which have been added to WOApplication (as an alternative, you can use the option described in the section Command-Line Options):

WOApplication Template Parsing Methods.
WOApplication
Method Description
setIncludeCommentsInResponses: (class or static method) Sets whether the application's HTML parser includes comments from a component's HTML template as part of a response. The default is YES or true. Use this method only in the application's initializer or constructor.
includeCommentsInResponses (class or static method) Returns YES or true if the HTML parser includes comments in the responses. Returns NO or false if the application doesn't include any comments from a component's HTML template in the response. The default is YES or true.

Table of Contents Next Section