XDoclet is very handy for generating .xml config files (amongst other
things) for struts and ejb.
It picks up special tags in javadoc comments in your classes and
generates .xml artifacts.

For example:

If you stick something like this in you Action class comments:

* @struts.action path="/token_if.search" name="token_if.search"
scope="request"
parameter="search,freeze,unfreeze,cancel,default=unspecified"
 * 
 * @struts.action-forward name="search" path="token_if.search"
redirect="false"

Then you can put something like this in an Ant target:
<target name="webdoclet">

        <webdoclet destdir="${basedir}/WEB-INF"
mergedir="${basedir}/WEB-INF/xdoclet-merge"
excludedtags="@version,@author,@todo" addedtags="@xdoclet-generated at
${TODAY},@copyright The XDoclet Team,@author XDoclet,@version
${version}" verbose="false" force="true">

            <fileset dir="${src}">
                <include name="**/*.java" />
            </fileset>

            <strutsconfigxml destdir="${basedir}/WEB-INF"
version="1.2"/>

            <strutsvalidationxml destdir="${basedir}/WEB-INF"
version="1.1.3" />
        </webdoclet>
    </target>

And it will generate struts-config.xml auto-magically.
Note you can specify a merge-dir where to put extra stuff you want to
add yourself.
The same logic applies to ejb (only the tags in javadoc comments
change).
You can also go one step further and create your own tags and
corresponding behavior to apply.

2 caveats:
- AFAIK you need servlet-api.jar to execute ant task
- Some xdoclet templates get confused if you use generics in your source
code.


David 

-----Original Message-----
From: samhr [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 24 de Novembro de 2006 9:54
To: user@struts.apache.org
Subject: Re: Struts+EJB


i read that chapter, what is xDoclet used for? is it a must to use them?
any alternative?
anyway thanks for replying



Stas Ostapenko wrote:
> 
> Hi !
> 
> Take a look at the book "Struts Kick Start" by James Turner and Kevin
> Bedell.
> "Chapter 18. Using Struts with Enterprise JavaBeans" - is nice
> introduction with example.
> 
> On 11/24/06, samhr <[EMAIL PROTECTED]> wrote:
>>
>>  Hi,
>>
>>  Am new to Struts, currently am creating an application using Struts
and
>> EJB.
>>
>>  I dont know how to connect the Struts with EJB component.
>>  Can someone pls help me? I searched for samples online, but am not
able
>> to
>>  understand them.
>>
>>  Does anyone has a sample code to integrate both of them, with
>> explanation?
>>
>>  Looking forward for an answer
>> Thanks in advance
>> --
>> View this message in context:
>> http://www.nabble.com/Struts%2BEJB-tf2696579.html#a7519838
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Struts%2BEJB-tf2696579.html#a7520856
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AVISO

Esta mensagem e quaisquer anexos seus podem conter informacao confidencial para 
uso exclusivo do destinatario. Cabe ao destinatario assegurar a verificacao de 
virus e outras medidas que assegurem que esta mensagem nao afecta os seus 
sistemas. Se nao for o destinatario, nao devera usar, distribuir ou copiar este 
e-mail, devendo proceder a sua eliminacao e informar o emissor. E estritamente 
proibido o uso, a distribuicao, a copia ou qualquer forma de disseminacao nao 
autorizada deste e-mail e seus anexos. Obrigado.

DISCLAIMER
This e-mail and its attachments may contain confidential information for 
exclusive use of its recipient. It is your responsibility to carry out 
appropriate virus and other checks to ensure that this message and any 
attachments do not affect your systems / data. If you are not the intended 
recipient you must not use, distribute or reproduce this e-mail and you must 
notify the sender and delete the entire email. Any unauthorized use, 
dissemination, distribution or copying of this message and its attachments is 
strictly prohibited. Thank You.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to