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.

Populate your drop-downs with listeners and allow for refreshing

Most webapps have drop-downs (a.k.a. pick lists) that users select from when filling in forms. Spring has a nice referenceData method on its Controllers that you can use to populate these, but I prefer a different way. In AppFuse, I populate these using a ServletContextListener. However, one of the problems with using this is that your drop-downs won't get refreshed unless you have admins screens or a way to reload the attributes set in the listener.

In short, I think it's a good idea to load drop-down options in a listener and also have an action or servlet to refresh these options. For examples, see StartupListener.java and ReloadAction.java. Got a better way? I'm interested...

Posted in Java at Apr 29 2004, 04:50:55 PM MDT 4 Comments
Comments:

Won't help you much with Struts, but I implemented Webwork2 interceptors to populate dropdown form data with Spring bean DAO's. The dropdown data is then stored in Xwork Application and Session maps. When an update occurs, the Action sets an invalidate flag that the interceptor picks up and reloads the dropdown. It works well for me, and I REALLY like how Xwork abstracts out any notion of the servlet environment. That's VERY nice for offline unit testing. No mocks needed. Sorry. Didn't mean to babble on about Webwork2, but it's good stuff. If they ever get solid docos and samples online, it could really gain some traction. I'm a believer. Btw, I was able to get StrutsMenu and DisplayTag working using Velocity templates (courtesy of WW's bodytag). No more JSP! Now if only we could eliminate those last few references to Struts RequestUtils and Globals in StrutsMenu (Navigator?), I could drop the struts.jar completely. Here's hoping! ;-)

Posted by Jason Boutwell on April 30, 2004 at 12:01 AM MDT #

XML-RPC!
.V

Posted by VIc on April 30, 2004 at 04:39 PM MDT #

You might be interested in taking a look at this one: http://www.webspherepower.com/issues/issue200310/00001123001.html

Posted by Nobody Important on April 30, 2004 at 07:46 PM MDT #

Wouldn't this be a good example of using the ApplicationListener framework within Spring? If you updated the datasource containing the informaton for your dropdown from within your application, you could then fire an event which ends up causing the action to reload the information from the datasource. The only downside to this is that the datasource would have to be updated from within your application, or else you wouldn't be able to fire the event. Although I couldn't find any examples of this, the documentation says you can have any wired bean listen for application events.

Posted by Eric Hauser on August 04, 2004 at 10:08 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed