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.

Hibern8 IDE

Max Andersen created a quick'n'dirty Hibern8 IDE in less than 3 hours tonight. For your viewing pleasure, he also created a viewlet. Very cool Max!

Posted in Java at Mar 29 2003, 11:58:47 PM MST 4 Comments

Struts Training: Week 4

I missed last week (Week 4, PosgreSQL), but I'm back this week - ready to report. I'm presenting next week on "remember-me" and XDoclet, so I'm working frantically trying to get AppFuse up-to-snuff to use as a lab template. Hopefully, I'll have that done by tomorrow night, as well as the lab and presentation.

Today's presentation is from James Turner on Indexed Properties and Validation. Awesome - I need this in my day job's project starting next week! Good timing, eh?!

So how do you use indexed properties in Forms? Two ways: Simple arrays of strings and arrays of beans (recommended). Here's a good tip - if you're using DynaActionForms, you can access a property in JSTL using {form.map.propertyName}. I did not know that - thanks James! Lots of good stuff in this one (too much to write down), I hope this preso is available online and a demo app goes with it. To validate simple array of strings, add indexedlistProperty to your <field> in validation.xml (you must also specify the property). If you're validating beans, use property="propertyName" and indexedListProperty="beanName".

However, do you really want to require all fields of your child beans? No, probably not. You (most likely), just want to require fields if some fields are populated. Struts provides us with the requiredif validator. No JavaScript validation exists for requiredif at this time. Hmmm, I wonder if XDoclet can generate indexed validation rules. Here's an example of how to do this with the current 1.1 RC1 Release.

<form name="myForm">
  <field property="lastName" indexedListProperty="person" 
    depends="">
    <arg0 key="label.lastName"/>
  </field>
  <field property="firstName" indexedListProperty="person" 
    depends="requiredif">
    <arg0 key="label.firstName"/>
    <var>
      <var-name>field[0]</var-name>
      <var-value>lastName</var-value>
    </var>
    <var>
      <var-name>fieldIndexed[0]</var-name>
      <var-value>true</var-value>
    </var>
    <var>
      <var-name>fieldTest[0]</var-name>
      <var-value>NOTNULL</var-value>
    </var>
  </field>
  ...
</form>

Note that the [0] is NOT an indicator of which indexed property to validate. RequiredIf is powerful but ugly, so James wrote something better. Unfortunately, it's too late for 1.1 and will be added for the 1.2 release. Sounds like most folks that use the Validator will be using a nightly build for awhile ;-). The new validator is called "validwhen," and looks as follows:

<field property="firstName"
  indexedListProperty="dependents"
  depends="validwhen">
  <arg0 key="dependentListForm.firstName.label"/>
  <var>
    <var-name>test</var-name>
    <var-value>((dependents[].lastName == null) or
                (dependents[].firstName != null))
    </var-value>
  </var>
</field>

Fricken sweet! James is sending me the code - cool! This will make my life soooooo much easier next week. Status of Struts 1.1 from James: they're working on getting the commons packages to a release state. Slides from today will be available at strutskickstart.com later this afternoon.

Posted in Java at Mar 29 2003, 09:32:28 AM MST 4 Comments