The Source for Java Technology Collaboration
User: Password:



Simon Brown

Simon Brown's Blog

XDoclet in the J2EE web tier

Posted by simongbrown on October 16, 2003 at 03:18 AM | Comments (10)

It's common that you'll find somebody using XDoclet to help build their EJBs, but how often do you find people using it to help with the J2EE web tier? In his recent weblog, Dave says he is trying to convince his team that using XDoclet is the way to go for generating artefacts like tag library descriptors and the web.xml file. I must admit that while XDoclet is very useful when building EJBs, I'm not sold on the idea of using for the web tier myself. Why? Well, I think that there are several reasons for this.

For each EJB, you have to build 3 classes and the ejb-jar.xml file - all of which can be automated with XDoclet and a single source file representing the bean implementation. This is nice because the remembering all that nasty EJB deployment descriptor stuff is a pain, and everybody knows it's a pain. In one of the JavaOne sessions that I went to this year, the EJB team talked about how they were thinking of taking advantage of the new J2SE 1.5 (Tiger) feature of annotations/metedata (JSR-175) so that the deployment descriptors were automatically generated. Basically this would make XDoclet-like, attribute-oriented programming available to the J2EE platform, and that can't be a bad thing.

Another reason to use XDoclet is so that package and class names are kept in sync between the Java source and the deployment descriptors. However, when you use tools like IntelliJ to refactor a class/package name, you can ask it to look in other files too so you get the deployment descriptor refactoring for free.

I do like using XDoclet for generating the EJB stuff, but for me it doesn't add much for the web tier technologies. Are you using XDoclet in your J2EE apps? I'd be interested to hear from anybody with thoughts on this.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • XDoclet all over
    Yes, I use (and evangelize) XDoclet for uses in much more than the EJB tier. I use it to generate struts-config.xml, the associated validation.xml, and starter JSP files for Struts form beans, as well as web.xml and TLD files in the web tier. At the EJB tier we generate custom utility "proxy" objects allowing AOP-like capabilities for our session bean calls.

    While I wouldn't push XDoclet for simple projects, I do for larger projects and it saves an enormous amount of time and effort.

    Posted by: erikhatcher on October 16, 2003 at 05:30 AM

  • XDoclet rocks for Struts
    Thanks to much of Erik's work - I use XDoclet in all my Struts projects. I like it best for generating ActionForms (who needs DynaActionForms?), my validation.xml and web.xml. On my existing project, struts-config.xml was already in place, so we haven't used it much for that - but I have on my last few projects. It's a huge time-saver once you have it configured. I've been lucky enough to base my last couple of projects on AppFuse (which takes a lot from Erik's JavaDevWithAnt sample app) - where everything is already setup for you. ;-)

    Posted by: mraible on October 16, 2003 at 10:01 AM

  • XDoclet is great - even for small projects
    Up here at Aberdeen University we teach xdoclet to the e-commerce masters students, and start with web projects without EJBs first. I figure this way they get used to the concept of auto-generation, and then they'll be ready for its fuller use when we get to EJBs. Anyways, yes it is a bit flakey sometimes, but it is still a wonderful little tool. You can focus on the coding without having to worry about the configuration files. Well, not too much anyways. This will be the second year that we're using it, and it's been good stuff. Wouldn't dream of not using it.

    Posted by: scharlau on October 17, 2003 at 06:24 AM

  • More than a time-saving device
    Like Erik, I use and evangelize XDoclet. I find XDoclet useful for many things more than just EJB, though. You see, XDoclet is about two things: (1) saving you time and trouble by generating artifacts for you and (2) helping to achieve what the pragmatic programmers call the DRY (don't repeat yourself) principle.

    In the case of EJBs, XDoclet scores off the charts in terms of time-saving and DRY. Servlets, however, don't do so well in the time-saving category, because there's just not as much to generate. But, while you don't gain much from XDoclet in terms of time-saving, you still achieve DRY code, regardless of how it is used.

    The same applies for using XDoclet with Hibernate, JDO, Apache Axis/SOAP, or JMX. Not much time-saving, but lots of DRY. With regard to MockObjects, XDoclet scores very high on time-saving and not so high on DRY.

    Again, keep in mind that XDoclet is about more than saving keystrokes...it's also about managing redundancy in our code.

    Posted by: habuma on October 17, 2003 at 10:23 AM

  • XDoclet in the web tier == good
    Struts is a great reason to use XDoclet, but WebDoclet does the trick for me. What most J2EE programmers don't realize is that they can accomplish most of things that Struts do by just using web.xml. In this case, XDoclet is extremely useful to a develolper. Jumping back and forth between your servlet code and web.xml can be annoying. Adding a new servlet and servlet-mapping to web.xml is simple with XDoclet. Need to add a new filter? A new listener? No need to go edit that web.xml file. Just add the javadoc tags. It is a very clean way to associate the neccessary attributes with the code they belong too.

    Posted by: ehauser on October 17, 2003 at 02:09 PM

  • XDoclet all over
    I also use XDoclet in collaboration with Struts, Servlets etc as described previously, but I was interested in what was said about generating custom utility "proxy" objects. Any chance you could blog a bit about this with some example setup? Pleease? :-)

    It sounds a bit like how we try to do things, but I have a feeling you've automated one step further than us.

    Posted by: miffel on October 21, 2003 at 03:59 AM

  • Help with Xdoclet and Axis
    Sorry to ask this on a blog, but failing to find this anywhere.

    Can anyone provide an Ant snippet or pointes for loading tasks and creating a target to generate wsdd files for Axis using XDoclet.

    Many thanks :-)

    Posted by: diabolist on April 28, 2004 at 02:45 AM

  • I preffer IDEs like Myeclipse that avoids the need to deal with this annotations, but let you use dedicated design views.
    D. Orbach
    javasight - java news & books

    Posted by: doronorbach on March 02, 2005 at 04:44 AM

  • wow power leveling
    wow powerleveling
    wow power leveling
    wow gold
    wow items
    feelingame.com
    wow tips
    Most Valuable WOW Power Leveling Service
    wow power leveling faq
    cheap wow power leveling
    wow power leveling
    wow powerleveling
    wow power lvl

    Posted by: wowleveling3 on December 13, 2007 at 05:58 PM

  • 网络营销软件
    网络营销软件
    网络营销软件
    群发软件
    群发软件
    ---
    群发软件
    网络营销软件
    论坛群发软件
    网站排名软件
    群发软件
    推广小助手破解版
    论坛群发软件
    网站排名软件
    群发软件
    网络营销软件
    网站推广软件
    信息群发软件
    论坛群发软件
    信息群发软件
    博客群发软件
    qq群发软件
    邮件群发软件
    博客群建软件
    企业名录搜索软件
    信息群发软件
    邮件群发软件
    论坛群发软件
    博客群发软件
    网站推广软件
    网络营销软件
    全能营销破解版

    Posted by: uuok999 on December 20, 2007 at 12:19 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds