Using Ant Properties, Init-Params, and Filtering

If you consider the init-param values we added to the comments, we really didn't gain anything from a standpoint of making the necessary changes between a production and a development run. In either case, we need to open the source code to add the appropriate table and account values. However, we can use Ant to further abstract the init-param values. Remember that Ant and XDoclet have the ability to replace value based on the properties defined within an Ant build script. With this in mind, we could create a two properties such as the following in our Ant build script:

<property value="production"/> <property value=" accounts"/>

Now in the webdoclet tags for the servlet, the following tags

@web-servlet-init-param value="production" @web-servlet-init-param value="accounts"

will be replaced with

@web-servlet-init-param value="$j table {" @web-servlet-init-param value="${account
}"

When the Ant build script is executed, the task to create the deployment descriptor will automatically replace the ${table} and ${account} with the values set by the properties.