Category Image Customizing WebObjects Java Templates


Here are locations where you can find templates used for project java files. Make backup copies of the originals before you begin customizing........

Application and Session:
/Developer/ProjectTypes/JavaWebObjectsApplication.projectType/Resources/English.lproj/projectTemplate

WOComponent files:
/Library/Application\ Support/Apple/Developer\ Tools/File\ Templates/WebObjects/Component.pbfiletemplate

Let's say you use log4j, and want all your Components to inherit from a custom WOComponent subclass named MyComponent, you could have your WOComponent template look like this:
//
// ?FILENAME?: Class file for WO Component '?FILEBASENAME?'
// Project ?PROJECTNAME?
//
// Created by ?USERNAME? on ?DATE?
//

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
import org.apache.log4j.Logger;

public class ?FILEBASENAME? extends MyComponent {
private static Logger log = Logger.getLogger( ?FILEBASENAME?.class );

public ?FILEBASENAME?(WOContext context) {
super(context);
}

}


Or if you want your HTML file to always declare a HTML4 DTD, you could change the html template to look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta name="generator" content="WebObjects 5.2">
<title>
Untitled
</title>
</head>
<body>

</body>
</html>

Posted: Monday - December 13, 2004 at 01:09 PM        


Published by