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 "struts". 749 entries found.

You can also try this same search on Google.

Commons Validator 1.0.1 Released

This release contains only bug fixes - there are no new features in this release. You can download the binary or source distributions, or simply checkout the Validator web site. I expect that will be included with tonight's nightly build of Struts.

Posted in Java at Dec 15 2002, 05:14:43 PM MST Add a Comment

RE: Struts? WebWork? Tapestry? Cocoon?

Aslak tipped me off about Anthony's Wafer research project. There I found the feature matrix of all the web application frameworks they've looked at. I don't know when this matrix was last updated, but I question a few of the entries for Struts. In particular:

  • Template Languages - it supports Velocity and XML
  • Security - it supports adding a role attribute to your action-mappings to secure servlets, as well as roles in Tiles, Struts-Menu and the logic:present tag library to limit access when using container-managed security. I'm guessing that they mean a different type of security here.
  • Documentation - Apache doesn't host an online demo, but I've seen many, for instance my strutscx demo [strutscx home]. There's also the stxx project. I'm guessing the development team has to host one to fit the satisfy the requirement here. It does have a number of tutorials though, including my favorite Strut By Strut. Example code is all over the place, O'Reilly has been pumping out a lot of it lately.
  • IDE Integration - Easy Struts and the Struts Console.
  • WAP/WML - The Struts WML Tag Library.

I hope this helps to boost Struts' credibility on this matrix. I'm off to Barnes and Nobles to write some more on Tiles and Exception Handling with Struts. It's open 9-11 everyday and all the local libraries closed at 5 today. I'm about halfway through the chapter (page 15). Tomorrow will be fun-filled with a full day at the library and hopefully I will finish. Then an all-nighter (maybe? I hope not) on Monday night to proofread, and then send on Tuesday. I doubt I can get my struts-resume app done by Tuesday night, so I'll probably turn that in later in the week. Although, using XDoclet, Hibernate and Erik's StrutsGen tool, I might just be able to pump the whole app out in a couple of hours!

Posted in Java at Dec 15 2002, 02:33:37 PM MST Add a Comment

Tomcat Deployment App

On of my clients has asked me to setup a deployment app. Basically, we have seven instances of tomcat setup through one Apache webserver. Apache proxies to each instance based on different domain name. They want the ability to upgrade each instance with the click of a button. Here's my idea:

  • Create a Struts-based app that allows file upload, where they can upload a war file.
  • Part of the file-upload process is selecting which servers they'd like to upgrade.
  • Based on the server names, the war file is copied and expanded in the tomcat/webapps/appname directory for each server.

Will this work, and can I do this through a webapp? It'd be cool to do steps 1 and 2 with a webapp and have step 3 run by Ant. Is it possible for a webapp to call Ant? The second piece that they're probably going to want is the ability to setup these virtual slices on the fly, from a web page as well. That might be a little tougher, as it would involve: editing http.conf/workers.properties, creating a new user for the slice, copying/expanding a base Tomcat install, editing the server.xml for new ports, creating a new MySQL instance for the slice, and finally, creating startup scripts. Yeah, I might have to pass on creating that app - probably not logical to do it from a webapp. Especially when it only takes about 10 minutes to setup right now.

Posted in Java at Dec 15 2002, 07:17:58 AM MST 4 Comments

Should I be using DBUnit?

Here's a question for you: Should I be using DBUnit in AppFuse and struts-resume? I've heard of it before, but have never used it. It sounds good:

The Dbunit database testing framework is a JUnit extension which sets up your database in a known state before executing your tests. This framework uses xml datasets (collection of data tables) and performs database operations before and after each test. The Dbunit framework supports both the clean insert and the refresh strategies.

Actually, know that I think of it, of course I should be! Currently, I use an Ant Sql task to create my database, and then Hibernate's SchemaExport class to create the tables. I have no way to automagically enter data into the database. I suppose I could use another sql task in my build file, but it sounds like this job is more suited for DBUnit. I don't want to give up Hibernate's table generation as it's smart and adds new columns when I add new columns to my VO. Hopefully these two can work together nicely.

I also found this Best Practices guide on using Hibernate. The first line about using fine-grained objects has motivated me to refactor my User class.

Write fine-grained classes and map them using <component> or <component-element>. Use an Address class to encapsulate street, suburb, state, postcode. This encourages code reuse and simplifies refactoring.

Posted in Java at Dec 14 2002, 01:37:09 AM MST Add a 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

What Maven Does

I, like Charles, was unsure of what Maven did. James has made it clear and I have seen the light - I think. In my AppFuse project, I have a lib directory that contains all the various third-party jars I'm using in my build process. Among these are XDoclet, Struts, Cactus, JSTL, Hibernate, JUnitDoclet, etc. The problem is that this directory is ~16MB and if I add it to CVS, I've got a monster project. The zipped up version of AppFuse's source is 14MB! That's enough to scare off folks right there.

It sounds to me that Maven can help me out in 2 ways. It can be used to download and install these jars as part of the build process. Slick if it can! Can it get me nightly builds from CVS? The 2nd feature seems to be building a project website for me. That's cool and definitely better than my simple readme file. However, can I make my site look like this (my site) rather than this (Maven site)? The good news I see is that the generated website does use XHTML and a DOCENGINE:

<!DOCENGINE html PUBLIC "-//CollabNet//DTD XHTML 1.0 Transitional//EN"
    "http://www.collabnet.com/dtds/collabnet_transitional_10.dtd">

The bad news is that it's not a standard DOCENGINE and even after I override the doctype and charset, it still does not validate. Of coure, this may not be a big deal, but if this were to be more "standard" it would be easier to convince folks like me to jump on the bandwagon. If there's templates I can modify, show me, and I'll dig like a miner that's struck gold.

Posted in Java at Dec 13 2002, 12:25:05 AM MST 2 Comments

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

Struts Books are Hot!

I found on the Struts website that the top 2 Java books sold at Amazon.com this month are Ted's Struts in Action and Chuck's Programming Jakarta Struts. You can look at the Bestselling Java Books for proof. Don't you find it strange that #3 is a Perl book though?!

Posted in Java at Dec 12 2002, 11:49:51 AM MST 2 Comments

How Hot are your Topics?

I noticed the "hot" links over at java.blogs this afternoon. They show who has the most read topics for a particular day - at least on that website. I had 2 of the top 3 yesterday! If that's not motivation for better writing, I don't know what is. But is this really a popularity contest? Are we trying to boost our Google/Java.Blog rankings? Probably not, but it sure won't hurt when you're out looking for a new job!

That being said, I interviewed for a J2EE developer position this morning. The project sounds pretty cool - using Struts, Servlets, JSPs and such to create a web front end to an Oracle database. The guy who interviewed me seemed very smart and would be great to work for - he's chosen J2EE as an architecture and wants to run the production system on Tomcat. Nice! All the stuff I've been working with for the past year and a half. He's probably reading this right now (I sent him the url to my blog), so hopefully this post helps me out. ;-)

Another reason for writing this post is to let you know that there is another open position on this project. Required Skills: HTML, XHTML programming. Any Java/J2EE, LDAP or Apache/Tomcat skills would be a bonus to complement the team. If you're interested and you live in Denver, let me know, and I'll send you the recruiter's e-mail. I believe the contract is for 3-6 months.

Posted in Java at Dec 12 2002, 07:58:24 AM MST Add a Comment

Design Patterns, Marc Fleury and JBoss

I just got back from the Denver JUG meeting and have lots to talk about. I've started this post at 11:03 p.m., for the record. I want to start out with discusssing a topic that Dave and I talked about a few days ago. Basically, in his Ag application, he is using one Business Delegate and one DAO to do all his business logic and data access. Actually, he's got two DAO's, one for Hibernate and one for Castor. Basically, the DAO is determined at startup, set on the Business Delegate and then stuffed into the servlet context. While Ag is a small application, it got me thinking. I believe the recommended pattern for this is to have a Business Delegate for each entity, as well as a DAO. So for a user, you would end up with 4 classes, UserManager/UserManagerImpl and UserDAO/UserDAOHibernate. So everytime I add a new entity, i.e. account, I have to create 4 new classes. What a pain, and a lot of copy and pasting - or at least that's how I'd do it.

Dave's KISS methodology at first struck me as strange, but then I thought, "Damn, that's a lot easier." So now in AppFuse (reference implementation: security-example), I changed to use this idea - with a BusinessManager/BusinessManagerImpl and ApplicationDAO/ApplicationDAOImpl. The idea is that these will contain any and all methods to access data.

I went to the DJUG meeting still struggling this this pattern, feeling like it stunk and I should back it out and go with a factory pattern and a business delegate/dao for each entity. However, during Marc Fleury's presentation, he preached that one of the founding rules of JBoss was KISS. He said that the greatest thing about open source is that no one will ever even look at your code until it's broken. "And how bad does it suck when you have to look through 5 levels of inheritence to figure out the problem?" He mentioned that bad code was his favorite, because chances are - if there's a bug - it'll be staring you in the face, rather than buried inside some design patterns and 10 different classes. I agree, so I'm going with KISS, but I'm also interested in hearing your opinions. I like the current architecture of AppFuse because it sets the business manager on startup, stores it in the servlet context and is available for everyone to use at any time. There's nothing saying that I couldn't set a SessionBean (on the business manager as it's proxy) and call EJBs for my persistence layer.

In fact, after Marc's gospel about JBoss, I want to use EJBs. In fact, not just EJBs, I want to use JBoss - and I can't wait for "JB 4." Why? Well they're adding the ability to add all of EJB's services (i.e. Security, Transactions, Persistence) to any POJO. This means that all you need to do is write a little deployment descriptor for it, and whalla, you're in business. His sermon is something you really need to see to appreciate. I can't do it justice in summarizing it here, but I certainly liked what he had to say, and feel like I'm a better person for it. The JBoss Group's goal is to become the de facto standard for application servers. I like their idea that the app server should be free - and the money (usually spent on app servers) should be directed towards smart developers instead. He also mentioned that JBoss Group (the company) is doing great right now and will be spending some cash on Marketing and PR to squash any rumors that it's not good enough.

Marc mentioned that most of the things he talked about tonight are written in his Blue Paper (PDF, 11 pages), titled "Why I love EJBs". It's part 1 of 3, the Blue of the "Red, White and Blue Technology Trilogy."

Other news that I stumbled upon today:

  • JBoss uses JavaGroups, and I've heard you can make work with Tomcat - for clustering and such.
  • The release plan for Struts 1.1 Beta 3 has been committed to CVS, code freeze this Saturday.
  • Ted Husted defends Struts after I posted it's recent criticizm to the mailing list.
  • The xPetstore Application has a new release. xPetStore is a refactored version of Sun PetStore application that shows how to use xDoclet to build WODRA (Write Once, Deploy and Run Anywhere) J2EE application. Tested with JBoss and WebLogic.

Phew, done at 11:44 p.m.

Posted in Java at Dec 11 2002, 05:37:32 PM MST 4 Comments