Matt RaibleMatt Raible is a writer with a passion for software. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.
You searched this site for "beans". 112 entries found.

You can also try this same search on Google.

XDoclet for Hibernate

A nice community-enhancing developer (I don't know who) has posted an XDoclet for Hibernate tutorial on Hibernate's Wiki. Good stuff. Since the XDoclet doco is kinda cryptic, it'd be awesome if someone did this for Struts. Maybe in my spare time. Oh wait, I have none of that - at least not this week.

I think XDoclet and Hibernate work well together when creating a database schema from scratch. However, I've found that Hibernate's Reverse Engineering Tool works much better for me. It generates the .java and .hbm.xml files for me and I'm done. Hook up a DAO and a DAOTest and I'm done! I might look at Middlegen's recently added Hibernate support in my next class-generation cycle. To my knowledge, it creates an XDoclet-enabled .java file that can then generate the .hbm.xml. However, I'm using a lot of composite-id stuff and XDoclet doesn't seem to support that. From the above XDoclet for Hibernate article:

Note that XDoclet will not be able to support the new composite features.

Posted in Java at Feb 13 2003, 05:22:44 AM MST 1 Comment

[ANNOUCEMENT] Commons Betwixt 1.0 Alpha 1 released

I don't use Betwixt now, but Roller does, and I plan to when I create my next webapp Configuration object. So, I'm interested and felt like enlightening you with some possibly useful information. ;-)

The Commons Team is pleased to announce the release of Jakarta Commons Betwixt 1.0 Alpha 1 from the Apache Software Foundation. Betwixt maps beans to XML and back again in a flexible, configurable way using reflection.

This is the first release of betwixt. For more details, see the release notes included in the distributions.

Download: Binary and Source

Posted in Java at Jan 28 2003, 04:34:55 PM MST Add a Comment

Upgrading to Struts 1.1b3 - Tips

I upgraded one of my client's applications from Struts 1.1b2 to Struts 1.1b3 tonight. It was a small headache, but not too bad. As far as the differences b/w 1.1b2 and 1.1b3 - they're pretty significant. Some classes/methods are downright gone - not just deprecated, but gone. Oh well, that's why it's a beta - and it's free, so who's complaining? I'll try to remember a few issues I found. The first is how to create a DynaActionForm. The code below worked with 1.1b2:

DynaActionForm messageForm = 
    (DynaActionForm) DynaActionFormClass.getDynaActionFormClass(
                     Constants.MESSAGE_KEY).newInstance();

But the getDynaActionFormClass method is now gone, so you have to use this:

FormBeanConfig cfg =
    mapping.getModuleConfig()
           .findFormBeanConfig(Constants.MESSAGE_KEY);

DynaActionForm messageForm =
    (DynaActionForm) DynaActionFormClass.createDynaActionFormClass(cfg)
                                        .newInstance();

A few deprecation errors cropped up as well.

  • Action.MESSAGE_KEY -> Globals.MESSAGE_KEY
  • Action.ERROR_KEY -> Globals.ERROR_KEY
  • org.apache.struts.validator.StrutsValidatorUtil -> org.apache.struts.validator.Resources

Finally, I found an issue with using BeanUtils.populate(dest, orig). It worked fine with 1.1b2, but throws a NPE with 1.1b3. I replaced this with BeanUtils.copyProperties(dest, orig) and everything works as it should. My guess (from doing a toString() on the orig) is that "multipartRequestHandler=null" was messing things up.

It's interesting doing maintenance/enhancements on code that I wrote a year ago. I've learned sooooo much since then. I wish I could go back and re-factor a bunch, but my client would never go for it - it works right?! Maybe I'll refactor some for kicks - just to see if it's possible. I'd love to replace a few DAOMySQL's with DAOHibernate's ;-)

Posted in Java at Jan 06 2003, 11:16:48 PM MST 6 Comments

How do you store your user's information?

After talking with Erik Hatcher a bit, I'm a bit worried about how I'm storing the current user's information. Basically, I'm putting a UserForm (extends ValidatorForm) into the session, and keeping it there to retrieve any user information I might need - in particular the userId. This is not the same as the user's login name, or the value I get from request.getRemoteUser(). How do you do this? I need the user's id from database lookups and filtering drop-downs, etc.

Posted in Java at Jan 06 2003, 07:54:05 AM MST 2 Comments

ArrayList vs. Vector - which is better for webapps?

I've always thought that it's best to use Vectors in Beans or ActionForms because they are synchronized. However, everytime I write one, I get the feeling that I might as well just use an ArrayList. What do you think? The different between the two is that an ArrayList is unsynchronized (seems strange to me since the it does implement Synchronized - the JavaDocs don't lie do they?). It is easy enough to create a synchronized ArrayList using the following code:

Collections.synchronizedList(new ArrayList());

I like ArrayList better, and I'd like to use it - should I just synchronize it on creation, or use Vectors?

Posted in Java at Jan 02 2003, 08:53:58 AM MST 13 Comments

Java Development with Ant, The Application

Ant Book If you've been fortunate enough to read Erik Hatcher's Java Development with Ant, you know that there's tons of good tips in it. I read it and I've been recommending it every since. Erik has been continuing development of the sample app for the book ever since it was released. I got many tips from Erik in developing AppFuse and I have to say, it really is a nice example. Maybe I'll get some more stuff now that it appears to have jumped from version 0.4 to 0.9! Here's a message Erik sent about the latest release.

All -

I'm proud (and worried about the support e-mails! :) to announce the 
near-final release of a project demonstrating Ant, XDoclet, Struts, 
JUnit, Cactus, and Lucene.  Its called JavaDevWithAnt as it was written 
for the book Steve and I co-authored and has been refined during 
several presentations I've been giving on Ant, XDoclet and Struts.

The documentation is in draft stage, and my primary goal is to collect 
feedback on polishing the documentation (and the application if there 
are any bugs that surface).  The site where I'm hosting the 
distribution and documentation is:

	http://www.ehatchersolutions.com/JavaDevWithAnt/

Please let me know if you try it out and have suggestions for 
improvement, or just to let me know you tried it and hate it or love 
it, etc.  Feedback more than welcome!  Direct feedback to me at 
[email protected]

	Erik

p.s. Since this e-mail is directed to the XDoclet, Lucene, and Cactus 
lists, here is a brief teaser for you:

XDoclet - its used extensively, even using a custom tag handler to 
generate starter JSP's from Struts form beans.

Lucene - my <index> Ant task is used to index text and HTML files, and 
Lucene's API is used at run-time to query the index.

Cactus - StrutsTestCase is used, although no direct Cactus tests.

Happy information-overload! There's a lot there, but if I could figure it out - I'm sure you can. Erik - finally on Jaguar eh? What took you so long ;-)

Posted in Java at Dec 27 2002, 07:25:45 PM MST 1 Comment

New Job, Struts, Testing Frameworks and Maven

I found out this afternoon that they want me for the job I interviewed for yesterday. I'm expecting to start on Wednesday. It's a small team of 3 folks and should be a lot of fun. I'm really looking forward to getting back into an office environment where I can converse with co-workers and such. After blogging for the last few months, I feel like the java.blogs guys are my co-workers, but it's still fun to talk and interact with folks. I never used to like it - I'd bring my lunch to work everyday, and hunker down like a code monkey the whole time - just trying to get my 8 hours in and get outa there. I'd get annoyed when people would stop to talk about their weekend or other random stuff. Now I'm going to be that guy - I'd better watch for the telltale signs of get the hell out of my cube! I wonder if we'll even have cubes? The floor where my interview was had just cleared out a bunch of folks - it was empty when I went in there. When I say cleared out, you know what I mean. Needless to say, there is plenty of space and plenty of computers available -- it'll be interesting to see what I get.

My last project had horrible machines - NT4 Gateways with 4MB video cards and about 700 Mhz. And this was last year!! I had just bought a brand new Dell 8100 P4 1.5 Ghz 2 weeks before I started the gig - so you can imagine my disappointment. And I was running XP at the time, albeit a beta version. But still, I felt like I was taking a huge step back in time. So I brought in my own Windows 2000 CD on my 8th day on the job. It all looked to be going pretty smooth (and the install was about to finish around 7 a.m. - I got there at 5) when everyone started rolling in. The video drivers weren't compatible and I was forced to humbly call tech support and tell that how I had violated all the rules. This place at least has Windows 2000, and I have my Powerbook, so all should be good. I just hope I can get a dual monitor setup - there's nothing quite so enjoyable.

This evening I did some minimal development on AppFuse. I spent most of the day writing the Struts Chapter. I'm on page 12 and expect to do 10-20 more pages. It was fun writing because I described tools that make developing Struts apps easier: Ant, XDoclet, JUnit, StrutsTestCase, and Cactus among others. I dug in a little to the Testing frameworks and played with them, but nothing too serious. I can waste many hours coding and I need to finish writing, then code later. I used 2 very cool tools today. The first is Canoo's WebTest. It basically is a framework built on top of HttpUnit that allows you to write all your tests as Ant tasks. It's fricken sweet as you don't have to really write any code, and it just worked for me. Check out this file (XML) to see how easy it is.

The 2nd tool was written by Erik Hatcher to generate JSPs and a resource bundle based on a Struts ActionForm. I hadn't tried it out until tonight and it just worked - my favorite feature in any software. The one area I think I might run into issues (in generating all this code), is when I have ArrayLists of beans on a form. I think Hibernate will allow this using Sets, Lists and other types of Collections, but I'm doubting that XDoclet's strutsform task will support it and I don't think Erik's too; generates nested tag libraries or anything like that. This is unfortunate because I'll probably get a wild hair up my you-know-what and want to create this functionality. And there goes my deadline, right out the window. Need.... to ... stay ... focused..!

Lastly, I made an attempt to mavenize AppFuse. It was pretty easy at first, as you're only required to alter this XML file to fit your project's needs. I realized I didn't have much as far as a CVS repository, mailing lists, etc., but I also realized that these would be almost essential to any project. And they'd certainly make things a lot simpler - even on a small team. When I got to the dependency section (which is what I really need), I sorta gave up. Here's my dependencies and their presence at the Maven Repository:

So while Maven looks great, it doesn't offer all the third-party jars I need. Is it possible to partially integrate? Also, I found the documentation to be a bit lacking on how exactly to configure each dependency. Is there a standard naming convention or versioning to rely on? It'd be great to have a list and possible versions - or even XML fragments you can copy/past. Can we, as developers, contribute nightly builds to the repository? I'd love to use both AppFuse and Maven at my new project, but I hate waiting on things to happen. If I can do anything to make the above modules/versions present in Maven, let me know.

Posted in Java at Dec 13 2002, 06:23:07 PM MST 1 Comment

Eclipse Plugins and Hibernate

I found a new site with a list of Eclipse plugins tonight. I was hoping that the Ant View plugin could solve my Ant problems in Eclipse, but I can't seem to figure out what it does. I gave it the ol' 30 seconds of investigation - maybe I should read the documentation. The problem I'm having now is (after swapping Ant 1.4 jars for 1.5.1) is:

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.

Hmmm, works fine from Cygwin, and Eclipse (2.0.2) has tools.jar and rt.jar in the classpath. Must be time to download a nightly build.

There was a lot of talk today in the java.blogs community about Hibernate. I'm happy to see this as it feels like I just bought a new car and everyone is saying it's the best car on the road. I decided to use Hibernate based on Dave's implementation in Ag. It looked easy enough, so I figured - why not?! It turns out, at the same time, that the XDoclet folks were in the midst of creating a new hibernate module in CVS. In fact, I got the hibernate module from Joel Rosi-Schwartz (I'm assuming a hibernate developer) before it was even in the XDoclet source tree.

I got to be a guinea pig in making hibernate tags work with XDoclet. I have to say that with Dave's working example, I was able to markup a POJO with hibernate/xdoclet tags and generate my persistence layer in a matter of minutes. It just worked. Kinda like Tomcat IMHO. That's how software should be. Check out my security-example if you're interested in using Hibernate with XDoclet. The readme in the source will explain how to run initial generation and tests. Currently, it generates a Struts Validator Form and VO from an Entity bean (located at src/ejb/org/apache/template/User.java). Why? Because Struts Forms can only be generated from Entity Beans. This needs to change IMO. But at the same time, the EJB architecture is already in place, I just need to execute the ejb-related tasks, and I'm in business.

In other news, a couple of Struts related goodies:

  • ONJava.com has an introduction to the Validator Framework by Chuck Cavanass, an Introduction to Eclipse and Creating Reports with FOP. I used FOP on a project last year around this time and it's super slick. It's basically using XSL to generate PDF and RTF from an XML file. I highly recommend using something like RTF2FO to generate an XSL Template from a Word document.
  • Struts Kick Start is now shipping from Amazon. I'd buy all the Struts books just to say you have them. I've got three ;) Haven't read any. Damn, I wish I had the time! Reading Erik Hatcher's Java Development with Ant was one of the smartest things I did this year. Actually, the smartest thing I did was get my wife pregnant yeah baby
  • I downloaded TogetherSoft's Control Center to do some UML Modeling for the Struts Chapter, and found that they use Struts on their site. Nice...

Posted in Java at Dec 12 2002, 05:37:04 PM MST 22 Comments

XDoclet and EJBs

I saw the following on the xdoclet-user mailing list today:

Chapters from Manning's "EJB Cookbook", by Ben Sullins and Mark Whipple will be made available on TheServerSide for public review. A chapter on "Code generation" is now available for download. "Code generation" presents the most common uses of XDoclet, an open source tool, tightly integrated with Ant, that lets you generate source code or other files.

Also, I just received the following e-mail from a fellow Denverite, Mike Clark:

Subject: Nice Blog

Hi Matt!

I've been enjoying reading your blog for a while and meaning to introduce myself since we both live in Denver. I'm speaking at the DJUG in April, so perhaps we can meet each other there.

By the way, my weblog is at: http://www.clarkware.com/cgi/blosxom.

Nice - gotta like e-mails like that!! Apparently, Mike is the Author of BitterEJB and also has some chapters for review at TSS:

If you're into JMS and message-driven beans, my "Bitter Messages" chapter is up for review on TheServerSide. As always, any feedback you might have is greatly appreciated!

Posted in Java at Dec 12 2002, 08:45:19 AM MST Add a Comment

The TVC Framework

Here's an interesting new extension for Struts:

The TVC Framework uses the Struts framework to create HTML tables with functionality that includes paging, sorting, filtering of data, and data validation.

This joins the ranks of Ed's <display:*> tag library and Yuriy's html table tag library. I've always like the display tag library as it's easy to setup and use - just pass it an ArrayList of beans and you're off! The TVC Framework seems to offer some cool functionality, but you have to pay $995 for the good stuff :(. Of course, if you're trying to code similar functionality on your own, you'd probably save your self some money if you bought it.

Posted in Java at Dec 11 2002, 04:20:36 AM MST 3 Comments