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.

Commons Validator with WebWork?

I'm in the midst of integrating WebWork into AppFuse. I started wiring validation last night. This morning, I realized that I could probably use Commons Validator to make validation a lot easier. Here's why:

  • WebWork validation rules are defined per-action, rather than per-object. This makes it difficult to define the validation rules with XDoclet. I can't just put tags in the model object to generate the validation rules. This works with Struts and Spring quite nicely.
  • Using a custom LabelTag, I've been able to hook into Commons Validator and mark fields as required. With WebWork's validation, it seems that this can only be accomplished by adding a required="true" attribute to my <ww:textfield>. I prefer the transparency of the custom tag.
  • I've never been able to get WebWork's client-side validation working. Commons Validator has excellent client-side validation support.
  • Spring has support classes for Commons Validator - leading me to believe that I can configure validation in Spring and re-use its JavascriptValidatorTag.

Now I just need to figure out 1) how to hook WebWork custom tags (or my own custom tag) into the validator to mark fields required and 2) how to write a validation interceptor that uses Commons Validator. Whaddya think? Are there advantages to using WW's validation over Commons Validator? Any tips for writing an interceptor or modifying the custom tags?

Posted in Java at Sep 04 2004, 11:10:08 AM MDT 4 Comments
Comments:

It's possible to define validation per object ("visitor validation"). Client side validation isn't finished yet but in my case it worked (and not by defining such large files as with Commons Validator). IHMO, the WW2 validation framework is better than the one provided with Spring. Once you've understood the concept, it can be really elegant stuff. Good luck, Lars

Posted by Lars Fischer on September 04, 2004 at 12:38 PM MDT #

Well, like Lars said, I wrote the visitor validation to allow you to apply validations to your model classes... In fact, at work, we haven't updated to WW2 yet, but we're using the validation framework as the core of our validation for our model classes in many different contexts. The interceptor should be easy. You can get to the Action and anything it has reference to, etc. I'm not sure what you'd need the tags to do, so I can't tell you how much work that would be...

Posted by Jason Carreira on September 06, 2004 at 02:05 PM MDT #

You can also use visitor validation on non-model classes...

Posted by Mark Woon on September 07, 2004 at 07:35 PM MDT #

I'm using WebWork 2 for the first time in the Castor Live sample app and I love it. I liked WebWork 1 when I used it (2.5+ years ago - before OpenSymphony was alive), but this is my first foray into the XWork/WebWork combo. So far, most of it is logical, albeit somewhat abstract and hidden at times due to a lack of full docs (I'm looking forward to the Manning WebWork book). But Kris Thompson has been gracious enough to help me out when I'm stuck or want to discuss strategies. Just in the last day or two I've begun thinking about implementing validation in the sample app (e.g. client-side vs. server-side, etc.). I guess I'll need to look into visitor validation.

Posted by Bruce Snyder on September 14, 2004 at 10:06 AM MDT #

Post a Comment:
Comments are closed for this entry.