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.

RE: Thoughts on the future direction of AppFuse

Sanjiv has some interesting thoughts on the future direction of AppFuse. To summarize: take on Seam head-to-head, but use Spring instead. Get rid of all the other frameworks except for JSF, Spring and Hibernate. Furthermore, focus on making Web 2.0 applications easy to create and use.

I like Sanjiv's ideas, but I'm not so hot on ditching all the other web frameworks in favor of JSF. I'm still not convinced it's the best solution for Java web development. The idea behind JSF is great, but the implementation has warts. Maybe that'll be fixed with JSF 1.2, but it will likely be quite a few months before MyFaces supports it. Yeah, I know there's the RI, but it is an RI and you remember the 1.1 version don't you? ;-)

I'd hate to give up WebWork support because I've used it on a couple of projects and really like it. Ditching Spring MVC would likely be a mistake as well since it's the most popular web framework among AppFuse users today. While I love what Tapestry brings to the table, it is harder (for the newbie) than JSF. Also, it seems to be the least-used web framework in AppFuse, which means I'm doing a lot of maintenance for no reason. AppFuse 2.0 will definitely make things simpler (JDK 5, Maven 2, standard directory layout, better IDE integration), but it will still be difficult to support 5 web frameworks and 2 persistence frameworks.

What do you think about Sanjiv's proposal? It sounds good to me. However, I'd rather see different lead developers for each framework and continue to support them all - except for Struts of course.

Posted in Java at May 22 2006, 08:16:53 PM MDT 28 Comments

Ajaxian Faces with David Geary

David wrote both Graphic Java Swing and Core JavaServer Faces (with Cay Horstmann). Both of these were best sellers on Java component frameworks. Not only that, but he's fun to talk to and lives just south of me in Colorado.

Agenda: Ajaxian Faces Essentials, Roadmap, Form Completion, Realtime Validation, Ajaxian Components, Ajax with Shale and Prototype.

Enterprise Java and Ajax: you invoke a URL from the client (XHR), then handle the URL on the server. This handling is usually done by a servlet, filter or a JSF phase listener. These return HTML or XML to the client. Then the client merges the response into the DOM on the client.

JSF and Ajax: JSF is an excellent framework for Ajax. Why? Because of its component model: GET and POST requests are supported and it has custom components and renderers. Furthermore, JSF has lifecycle and event handlers - phase listeners and allows complete control over the lifecycle.

Common Ajaxian use cases: form completion, realtime validation, polling (progress indicators, realtime search, etc.), ajax components and frameworks. In this talk, we'll be covering JSF (POSTs and GETs), JSF and JavaScript, how to control the JSF lifecycle, JSF client ids vs. component ids, accessing view state, and many other things.

Arm yourself with tools: Firefox with the Web Developer Toolbar. Most helpful features: outlining block elements and DOM inspector. Debuggers on client and server: IDEA on the server, Venkman on the server.

Good Resources: Java EE Blueprints, Ajax Magazine and MSDN.

JSF and JavaScript: The HTML component tags have all the event handlers built-in: onclick, onblur, onfocus, etc.

<h:form id="form">
    <h:inputText id="name"/>
    ...
</h:form>

In the above example, the component id is "name" and the client id is "form:name". To do minimal Ajax with JSF, you can use a non-Faces object to handle the Ajax requests with a servlet or filter. All you really need to know is how to reference client ids vs. the ids you code into your view templates.

Realtime validation: to do this, you need access to the view state. Ajax will fire a component's validators, invoke a phase listener (after the Restore View phase), POST a request with XHR and utilize client-side state handling. A typical component tree for a form consists of a UIViewRoot, an HtmlOuputText (instructions for form) an HtmlForm and an HtmlPanelGrid that contains all of the input components.

The JSF Lifecycle: Restore View -> Apply Request Values -> Process Validations -> Update Model -> Invoke Application -> Render Response. You have to do a post with JSF, otherwise the view state won't be available.

To register a phase listener, you merely declare it in your faces-config.xml file. There's a PhaseListener interface that defines 3 methods: getPhaseId(), beforePhase() and afterPhase(). In this example, getPhaseId() returns PhaseId.RESTORE_VIEW and beforePhase() isn't implemented; afterPhase() is used. David then checks for an "ajax" parameter. If it's sent in the request, he grabs the component to validate and invokes all its validators. One of the nice things about JSF is you can modify your client-side components on the server-side. You can also use JavaScript on the client-side to grab the hidden client-side state-saving field and send it with an Ajax request to maintain state.

JSF Ajax Components: To create JSF Ajax components, you'll want to put your JavaScript into a separate file. In the component's renderer, you'll write a <script> tag that uses a JSF page as its "src" element. Then you use a PhaseListener that looks for the URI invoked by "src" and handle it appropriately. Now David is showing us how you need to create a component, a Tag and a Renderer to create an Ajax component. The Tag and the Renderer write out JavaScript functions that do the magic stuff. Finally, you'll need to create a JavaScript file that contains the functions to be called. At this point, ragged on Geary a bit for creating a simple component with 3 Java classes + a .js file.

Rather than writing all this low-level JavaScript code yourself, you can simplify development with JSF and Ajax by using Struts Shale. Features of Shale include.

  • Web flow
  • Remote method calls
  • Tiger extensions
  • Integration with: Spring, Tiles, JNDI
  • View controllers
  • Testing framework
  • HTML views (a.l.a. Tapestry and Facelets)

David gave a quick preview of Shale and showed how much easier it makes Ajax. Basically, you give a specialized URL on your client - and using a syntax of "dynamic/managedBeanName/method", it calls that method on the server. Pretty cool stuff, but doesn't seem a whole lot different from what DWR offers for JSF. "Shale is a proving ground for JSF 2.0, hopefully all its add-ons will make it into the next version of the spec." When David says stuff like this, I'm tempted to use Shale in AppFuse for its JSF support - especially since Shale can work with any JSF implementation (1.1 RI, MyFaces or 1.2 RI).

As usual, this was a good talk by David. He's always entertaining and fun to harass. ;-)

Posted in Java at May 12 2006, 06:06:55 PM MDT 3 Comments

Ajax on Struts with Patrick Lightbody

I'm sitting in Patrick Lightbody's presentation on Leveraging AJAX in modern web frameworks. The point of this presentation is to give a preview of what's coming in Struts Action 2.0. There are a number of other good sessions I'd like to go to, particularly Intro to Dojo, but I figured it's better to attend this talk since AppFuse will be moving to SAF as part of 2.0. We're in a fairly small room, and there's about 20-30 people in attendance. With 400+ people at this conference, the other sessions are likely packed.

Ajax is more of a technique, rather than a technology. Commons Ajax techniques include:

  • Tabbed pane
  • Validation
  • Polling
  • Tree widget
  • Voting

For SAF, there are three core building blocks/tags: <saf:div/>, <saf:a/> (results evaluated as JavaScript) and <saf:submit/>. Divs are where things "happen" and links/submit buttons can trigger events. There are two frameworks used is SAF:

  • DWR: Remote invocation service for Java <-> JavaScript
  • Dojo: Language/server-agnostic JavaScript framework

There are two styles of Ajax: DOM manipulation (DWR) and partial pages (Dojo). SAF provides three Dojo widgets: BindDiv, BindAnchor and BindButton. The div tag supports the following attributes: href, updateFreq, delay, loadingText, errorText, showErrorTransportText, listenTopics and afterLoading. A simple example is polling - where the remote action returns HTML:

<saf:div href="mailbox.action?id=%{id}" updateFreq="2000"/>

Advanced usage of this tag includes adding a <script> block to the returned HTML. It will be executed when rendered, just like normal JavaScript is.

Tabbed pane is another component that's made up of two tags: <saf:tabbedPanel/> and <saf:panel/>. Rather than specifying content/tags within an <saf:panel>, to use the Ajax version, you simply add remote="true" and href="remoteUrl" to <saf:panel>. I asked about remote="true" being redundant and Patrick agreed it should be implied when an "href" attribute is defined.

SAF also includes the ability to have topic-based events. Dojo supports an event system, which was originally donated by the WebWork developers. Any element, such as a div, may listen to multiple topics. Any element, such as an href or tab header, may notify a topic.

The last thing that Patrick is demonstrating is Validation using DWR. To use it, you will need to use SAF's Ajax theme, as well as have DWR installed and configured. The remote calls to SAF's validation engine return serialized objects rather than HTML "partials". By default, it uses onBlur events to do the validation and all that's required on the client-side is validate="true" on your <saf:form>. Another cool Ajax feature that SAF has is an OGNL Console that gives you a command-line interface to evaluate OGNL expressions.

Patrick's lessons learned from implementing Ajax into WebWork/SAF:

  • Simple combinations of the basics can create powerful features, such as the tabbed pane or the tree widget.
  • JavaScript inside an HTML block (<saf:div>) or as returned from an action (<saf:a>) can provide valuable glue code.
  • The <saf:div/> and <saf:action/> tag have a close and important relationship.
  • Understand the important differences b/w Ajax styles (DOM-based vs. snippet-based). Both have their places.

Pitfalls:

  • Remember: there is no silver bullet
  • At the end of the day, your application is still a web site - don't forget that
  • Excessive polling can lead to extreme load and/or thread starvation
  • Common functionality, such as the back button and printing, can become difficult or confusing for the user (Dojo can help solve this problem)
  • Browser incompatibility can lead to two versions of the same application (see GMail)

The Struts Team hopes to release a preview release of Struts Action 2.0 this week or next, with a final release targeted for August.

Posted in Java at May 11 2006, 11:49:11 AM MDT Add a Comment

San Francisco - here I come!

The Ajax Experience I'm sitting in Denver's aiport, getting ready to jump on a plane and head to San Francisco for the Ajax Experience. Like most No Fluff shows, this one has 2-3 sessions I'd like to see during each time block. My primary goals are 1) to learn a lot 2) to blog about each session I attend, and 3) to get a good sense of what each Ajax framework does well. Hopefully there will be lots of demos I can link to.

On Friday night, a few AppFuse enthusiasts and I are getting together at the Thirsty Bear. If you'd like to join us, leave a comment and show up around 8:00.

Posted in Java at May 10 2006, 11:56:44 AM MDT 4 Comments

Better client-side validation with Prototype

I'd love to see something like Really easy field validation with Prototype integrated into Commons Validator and other web frameworks' validation engine. The only hard part would be looping through form elements and adding classes with the validation information. Other than that, it doesn't seem like it'd be too hard to implement. Hat tip to Ajaxian.com.

Posted in Java at May 09 2006, 02:59:29 PM MDT 7 Comments

ADF Faces goes open source

It's likely you originally heard about ADF Faces being donated open source way back in December 2005. Looks like it's finally happened. It's going to be tough for Tapestry and Wicket to compete with JSF when big companies are providing components for it. The after-market for a web framework can certainly influence decision-makers.

Posted in Java at May 07 2006, 03:33:48 PM MDT 2 Comments

AppFuse plans for the week

AppFuse Like most Java open source projects, I hope to release a new version of AppFuse this week before JavaOne. There's a couple reasons for this: 1) so I have the latest and greatest to demo during talks and 2) so the article I'm writing is up-to-date. Unfortunately, with both AppFuse and Equinox it's a bit difficult to make sure I'm using the latest and greatest for everything. This is because they're both very thin layers on top of their underlying dependencies.

I'm willing to bet that a few of these dependencies will have new releases this week, as developers scramble to get a bunch of stuff done before JavaOne. Here's my release predictions for this week:

  • Acegi Security 1.0
  • DWR 2.0
  • Hibernate 3.2
  • Spring 2.0

My current plan is to fix outstanding issues for 1.9.2 and then hold off to do the release until this weekend. Hopefully that gives each project enough time to pump out a release. If you happen to be involved with any of the projects that AppFuse depends on - and you're not planning on releasing before JavaOne, please let me know.

The 1.9.2 release of AppFuse will (hopefully) be the last one in the 1.x series. Work on 2.0 will begin towards the end of this month. See the roadmap for the cool stuff coming in 2.0.

As far as the CSS Design Contest, I'll announce the winners tomorrow. I also plan to fix this site in IE tonight and take another stab at making the header images and colors easier on the eyes.

Posted in Java at May 07 2006, 10:49:04 AM MDT 4 Comments

Integrating Google Maps, Mule and ActiveMQ with AppFuse

Stephen Pasco has written a nice tutorial on how to integrate Google Maps, Mule and ActiveMQ with AppFuse.

Here's the scenario: Upon opening a Google map client, within a web browser, the user clicks on the map creating points (Figure 1). With each point created, a message is immediately sent to the ESB containing the point's longitude and latitude. A second, remote client instantly receives the sent longitude and latitude coordinates and displays them on a separate Google map (Figure 2). [Read More »]

Good stuff - thanks for the writeup Stephen!

Posted in Java at May 02 2006, 07:35:13 PM MDT 2 Comments

JavaMail goes Open Source

JavaMail is now open source as part of the GlassFish project. Can we get those JARs on ibiblio now and make Maven more usable?

April 19, 2006
JavaMail is now open source! The source code for the JavaMail API Reference Implementation is now available under the CDDL open source license, as a part of Project GlassFish See the mail module page at GlassFish for more details.

Posted in Java at Apr 29 2006, 12:40:44 PM MDT 1 Comment

Heading to the Big Apple

May is shaping up to be quite the travel month. Next week I'm heading to New York City to put on a 5-day seminar for a client. Topics include: Web Frameworks, JSF, Ajax, Spring, Spring Web Flow, Hibernate, Caching and Performance, Deploying to Production, Comparing CMS Applications, eCommerce in Web Applications, Sharing with RSS and Atom, Acegi Security, Storing User Preferences, Source Control with Subversion and Coding Standards/Project Management. Yeah, a whole slew of stuff. There's nothing like doing a customized seminar when the client gets to pick whatever topics they like. ;-)

The only things I'm a little light on are Comparing CMS Applications, eCommerce and Storing User Preferences. For Comparing CMS Applications, I'm going to talk about Alfresco, Drupal, Joomla, Magnolia, OpenCMS and Plone. I'll be talking about ease of installation, ease of use, community and support, extensibility and performance. One thing I plan to do is zing CMS providers about eating their own dogood. As far as I can tell, neither Alfresco nor Magnolia use their own CMS for their websites. Of course, they might not be developing a "CMS for the web", but that's what most folks tend to use CMS's for IMO. It should be interesting to see if the Java solutions have decreased their installation times. Drupal, Joomla and Plone all took under a minute to install (on OS X) the last time I tried. If you happen to work on one of these applications and want to point out a kick-ass site developed with your software, please leave a comment.

As far as eCommerce solutions, most of the applications I've worked on recently just hook in with PayPal. This seems like the best solution because you eliminate the headache of credit card processing and in-house security/fraud preventation. If you've recently developed an e-commerce enabled application, what solution did you use? Did it work well for you? I'm also interested in solutions that were utter failures or a pain in the ass to use.

Lastly, as far as storing user preferences - I can only think of 3 ways to do it: cookies, database tables, and using the Java Preferences API. I'm sure I'm missing something. What solutions have worked well for you?

After returning from NYC, I'll be in Denver for 5 days before flying out to San Francisco for The Ajax Experience and JavaOne. In the midst of all the travel, I hope to finish up the CSS Design Contest, release Equinox 1.7/AppFuse 1.9.2 and do some performance tests with the T2000.

Posted in Java at Apr 27 2006, 12:17:39 PM MDT 12 Comments