The output generated by Code2Web in either of its three forms (program, class and JSP Tag) is configured by setting a series of properties.
Some of the properties are global and available regardless of the source code language that Code2Web is processing. For example, the tabSize property specifies how many spaces to use whenever a tab is found in the source code, and this property exists for all supported languages.
Some other properties are specific to a set of languages. For example, the keywordStyle property - which determines the name of the CSS style used for keywords - is available only for languages like Java and Javascript, while the entityStyle property is available only for XML/HTML languages.
All properties have reasonable default values which are documented throughout this manual, so Code2Web should run properly even if nothing is configured.
Code2Web employs a consistent mechanism for specifying values of properties. Let's assume you want to change the value of the keywordStyle property.
configure( String propertyName, String value)
method. For example:
HTMLConverter conv = new HTMLConverter();
...
conv.configure("keywordStyle","keywords");
...
code2web .... --keywordStyle=keywords ...
<c2w:convert ... keywordStyle="keywords" ... />
If you use many times the same set of configuration options, you might find it useful to store them in an external configuration file. Once you have that file, you can simply refer to it.
The format of an external configuration is simply a .properties file with the names of the properties and their corresponding values. For example:
skins=Eclipse,styles/eclipse.css
title=ClassResolver.java
titleLocation=http://www.planetalia.com
author="Alexander Hristov"
generateOutline=true
generateJavadocLinks=true
javadocs=C:\Archivos de programa\Java\jdk1.5.0_05\docs\api,http://java.sun.com/j2se/1.5.0/docs/api
generateNavigationBox=true
showLineNumbers=true
highlight="5..40,90..100"
hide="120..150"
To read an external configuration use the --config command line argument:
code2web .... --config = c:\foo.properties
To make HTMLConverter read an external configuration, use either of the available configure() methods:
public void configure( Properties options )
public void configure( String fileName )
To refer to an external configuration with the JSP tag, use the config attribute. Have in mind that this attribute takes a URL relative to the current application context root.
<c2w:convert ... config="/WEB-INF/code2web.properties" />
In all the above cases, you can use simultaneously an external configuration file and values established by hand.