Matt RaibleMatt Raible is a Web Developer and Java Champion. 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 "java". 1,588 entries found.

You can also try this same search on Google.

ActionForms: Struts' bastard child

Folks that rag on Struts seem to point to ActionForms as one of its major design flaws. I've been slightly frustrated with ActionForms this week, but overall, I think they're a good thing. It's possible my ActionForm affection is misguided. The major reasons I like them is because I believe they allow me to do stuff that is not possible in other web frameworks. I definitely could be wrong though, so I'm hoping the other framework authors/users will speak up and say "My framework does that!" Specifically, I'm talking to the WebWork, Tapestry, JSF and Spring folks.

I do wish that I could throw my POJOs up to my UI, so I hope the following things are possible with the WTJS frameworks. It would simplify things if I didn't need to transform POJOs -> ActionForms (particularly with Hibernate).

  • Validation and re-displaying the user's entered values. I love Struts' Validator. It's great how I can generate the validation.xml file with XDoclet and have a "required" struts.validator tag right next to a hibernate not-null="true" tag. Two questions:

    1. Can any of the WTJS frameworks re-display the user's entered values? Specifically, back into the input fields where the user entered them? I think this is important for useability.

    2. Do any of them have the ability to generate client and server-side validation, or at least declaratively write it in XML?

    I'd love to find a way to hack the Validator to allow you to define validation rules for a POJO and then use an Interceptor to validate it. I don't like how Spring requires you to write YAJC (Yet Another Java Class) to do validation.
  • Handling checkboxes. The basic reason for the reset() method in ActionForms is to handle checkboxes. Since unchecked checkboxes don't send a value - there needs to be a way to set a boolean back to null. I'm sure all of the WTJS frameworks support checkbox handling, I just want to make sure - and frankly - I'd like to learn a little more about how each framework handles it.

I guess there's only two reasons I like ActionForms - the major one being the ability to specify (and generate) my client and server-side validation in XML. If I don't find this same slick feature in the other frameworks, I might have to do a bit of hacking to do the Interceptor with Validator thing - but hopefully I won't need to go there.

Posted in Java at Feb 04 2004, 08:31:13 PM MST 25 Comments

[ANNOUNCE] Hibernate 2.1.2 Released

Hibernate 2.1.2 has been released. Looks like they fixed a whole sh*tload of bugs. Read the Release Notes or Download. All tests pass in AppFuse!

Posted in Java at Feb 04 2004, 04:18:51 PM MST 1 Comment

Running AppFuse on Orion (a.k.a. OracleAs)

Mike Lawrence has been beating his head against the wall trying to get AppFuse running on Oracle App Server for the last few days. The good news is he finally got it working and he's written up some documentation. I wiki-fied his contribution and now I present you [How To run AppFuse on Orion|AppFuseOnOrion]. Enjoy!

Posted in Java at Feb 04 2004, 10:18:41 AM MST 2 Comments

AppFuse Refactorings Part I: Changing directory structure

I changed the directory structure of AppFuse's "src" and "test" directories this weekend. Rather than:

src 
  - common
  - ejb
  - web

I changed it to:

src
  - dao
  - service
  - web

The change wasn't too difficult, but the results of doing it make me a bit sick to my stomach. I always new that the Managers in AppFuse were dependent on Struts, that's why I originally put them in the src/web/**/webapp/service folder. Now that I've moved them into the service folder, they don't inherit all the luxuries like struts.jar being in the classpath. Even worse, to compile the Managers, I have to compile any ActionForms, both from the build/web/gen directory, as well as from src/web/**/Form. This is because the Managers use BeanUtils.copyProperties() to transfer values from POJOs -> ActionForms and visa-versa.

Ech - this exercise has really shown me how tied together the different directories and layers are. I think I liked it better the other way - or maybe I just liked not knowing how tightly integrated everything was. ;-) The most frustrating thing turned out to be that Ant's <javac> task wanted to re-compile the generated ActionForm's each time I I ran "ant compile-service". Adding an <uptodate> property fixed this problem, but it seems like it should be easier than that.

I ended up putting the org.appfuse.model package in the "dao" directory. It just made things easier - since the model.* classes are used in my DAOs and the "test-dao" needs the XDoclet-generating Hibernate mapping files. I didn't want to have to depend on classes in the src/service directory to compile src/dao. It's bad enough I have to do that with the service-web stuff.

All in all, I'm happy with the refactorings, but implementing workarounds for the service-web relationship was no fun. I probably did this when I originally created AppFuse, but since I haven't heavily manipulated build.xml in so long - I've forgotten the trouble I went through.

Oh yeah, I also integrated Spring for binding the layers and configuring Hibernate. And Charles' persistent cookie strategy? That's done too. I'll write up details on both of these refactorings in the next couple of days.

Posted in Java at Feb 03 2004, 03:56:27 PM MST 10 Comments

One big Service class or several small classes?

I asked this question on the Spring Forums a couple of days ago, but I didn't get a response, so I'll try it here.

Looking through the Spring's petclinic and jpestore applications - both seem to advocate one single class to interface with the database (hibernate or dao/ibatis). I also noticed this pattern in Java Open Source Programming. Is this a recommended pattern or do you still think there's value in several service-level classes (i.e. one for each DAO)? I imagine the single interface and impl could grow quite large on a big project. In fact, in the Spring examples, the Manager isn't even a Business Delegate, it's really a Persistence Manager.

BTW, the Petclinic app is a helluva plug for Hibernate. The Hibernate implementation class is 53 lines, and the JDBC implementation class is 770 lines! If you're still using JDBC over Hibernate, please explain why you put yourself through the pain?

I do like the simplicity of the Single Manager approach, but I tend to do 1 Manager for each DAO (or something resembling this pattern). What do you advocate? AppFuse follows the 1-Manager to 1-DAO pattern. Should I switch to the Single Manager pattern?

Posted in Java at Feb 02 2004, 09:44:39 AM MST 19 Comments

JavaBlogs and Roller's duplicate post problem

Charles has figured out why JavaBlogs gets duplicate posts from Roller-based blogs. And Dave proposes a solution:

I just now changed the JRoller "absolute URL to site" setting to force the domain name to jroller.com. The setting was blank before.

Without this setting, the JRoller feeds were using whatever hostname was requested at cache refresh time. So if the first request after the cache timeout was for freeroller.net then the GUID's in the RSS feed would read freeroller.net until the next cache timeout.

This site was missing the absolute URL to site setting as well, so I changed it to http://raibledesigns.com. I'll try adding myself back to JavaBlogs aggregator and hope that works!

Posted in Java at Feb 02 2004, 08:46:25 AM MST 3 Comments

[AppFuse] Use Velocity instead of JSPs for your view?

If you want to use Velocity Templates instead of JSPs in your AppFuse-based web application, Cameron Gray has figured it out. Not only did he figure it out, but he was nice enough to write up a tutorial on it. Thanks Cameron - the time you took to write the tutorial is greatly appreciated.

In other AppFuse news, Rick Hightower seems to have convinced it to work with MyEclipse, JBoss and the Firebird database. Also, I received a few messages this week and I think another user has convinced it to run on Orion/Oracle successfully! If I ever get motivated, I'll try to put How-Tos on the wiki for all of these.

Posted in Java at Jan 31 2004, 10:01:59 AM MST

Tomcat's Ant Tasks

Since I hold the top 3 spots on Google for Tomcat's Ant Tasks, I figured it was about time I figured out how to use them. So I did - you can read the How-To on my wiki. They're pretty slick now that I have them working. The real power (as I see it) is that ability to install a WAR on a server other than localhost. Does your appserver have Ant tasks to ease your deployment headaches? If so, I'd like to hear about them.

I also upgraded to DBUnit 2.0 and JSTL 1.0.5 today. They seem to be good releases - all my tests run without errors.

Posted in Java at Jan 30 2004, 07:20:30 PM MST 1 Comment

Want to use Struts with EJBs?

If you're looking to use EJBs in your Struts project - you might want to take a look at StrutsEJB on java.net. I have no opinion on this project, just thought I'd provide a little visibility.

Posted in Java at Jan 30 2004, 08:27:34 AM MST 2 Comments

Ant 1.6.0 with Canoo's WebTest and AppFuse

If you want to use Ant 1.6 with Canoo's WebTest, you'll need to patch the source. Many thanks to Paul Kavanagh for providing the patch - I hate it when I can't upgrade to the latest release. Since AppFuse relies on WebTest for running its JSP tests, you must patch webtest to use Ant 1.6. Or you can can just download webtest.jar and put it in your lib/webtest*/lib directory. This is the from the latest version of WebTest's CVS (build 379 is the latest release used in AppFuse).

Posted in Java at Jan 29 2004, 01:43:00 PM MST 1 Comment