ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
In above Ant example, the filter in the
englishSetup
target sets the bye token to
goodbye
, while the filter in the
spanishSetup
target sets the bye token to
adios
.
Later, when the script uses a copy task with filtering on, it applies the filter to all files in
the file set specified by the copy. The copy task with filtering on replaces all
occurrences of the string @bye@ with
adios
if the
spanish
property is set but to
later
if
the
spanish
property is not set.
Even Easier way...
While this is one way to solve this problem, there is an easier way. Every attribute
value in XDoclet can be set with an Ant Property. Since you generate the related files
with XDoclet Ant tasks, XDoclet has access to all of the ant properties. Thus, you could
set the values as follows:
...
* @web.servlet init param
name="hi"
*
value="${basic.servlet.hi}"
*
* @web.servlet init param
name="bye"
*
value="${basic.servlet.bye}"
...
*/
public class BasicServlet extends HttpServlet {
Then when you generate the
web.xml
file the
hi
and
bye
initialization parameters
would be set to whatever the current value of the
basic.servlet.hi
and
basic.servlet.bye
properties are set to in the Ant build script. XDoclet and Ant
work well together to configure J2EE components into applications. The key take away
Page 12 of 49
Enhance J2EE component reuse with XDoclets
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved