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.

XmlHttpRequest

Dave quotes it, Charles writes it. XmlHttpRequest is the topic at hand and how it will help us build the next generation of web UIs. I've used Brent Ashley's JSRS Library to do some fancy UI work (one drop-down populates another) last year. It worked well in combination with Erik Hatcher's articles: Remote scripting using a servlet and Sending rich messages between client and server using asynchronous messaging. The project was AppFuse based, so I have the code if someone really wants it.

An example of XmlHttpRequest is in Roller itself - in the twisty comments you see on this site. For those who have used them, you probably know they're somewhat buggy. With all this talk of XmlHttpRequest, maybe it's high-time to revisit Roller's implemenentation and see if the technology has gotten any better. In reality, I know it hasn't - it's the browsers that are the problem and there hasn't been an update to IE in quite some time. My code could probably use some work though. If you want to dig in and check it out, here's the xmlextras.js that does the heavy lifting and comment-specific JavaScript.

After looking at this code this morning, it looks like there's different methods being used for the different browsers.

/////////////////////////////////////////////////////////////////////
//// XML Document loading

function loadXMLDocument(aURL, aCallback)
{ 
  gMediaCallback = aCallback;
  
  if (window.ActiveXObject) {
    // Internet Explorer XML loading syntax
    gMediaDoc = new ActiveXObject(getControlPrefix() + ".XmlDom");
    gMediaDoc.onreadystatechange = onMediaReadyStateChange;
    gMediaDoc.async = true;
    gMediaDoc.load(aURL);
  } else {
    // Mozilla XML loading syntax
    gMediaDoc = document.implementation.createDocument("", "", null);
	var xmlHttp = new XMLHttpRequest();
    xmlHttp.overrideMimeType("text/xml");
	xmlHttp.open("GET", aURL, false);
	xmlHttp.send(null);
    gMediaDoc.loadXML(xmlHttp.responseXML.xml);
    onMediaLoaded();
  }
}

I wonder if there's a common way that can be used for both browsers? BTW, 99% of the code for these comments was borrowed from Joe Hewitt.

Later: Another article covering this technology: Using the XML HTTP Request object. Hat tip to Carl.

Posted in Roller at Dec 11 2004, 09:29:09 AM MST 13 Comments

Can you test all of AppFuse?

I'll admit, it's time for me to get a G5. I can no longer test everything in AppFuse in one fell swoop. When I try to run this Ant build file(info) (which I'd like to use with CruiseControl) on my Mac and Linux machines, I get OutOfMemory errors. My PowerBook has ANT_OPTS set to "-Xmx768m" and my Fedora Core 3 box has it set to "-Xms1024M -Xmx1024M". Both machines have 1 GB of RAM. The build dies a lot sooner on Linux (15 minutes), and the PowerBook gets really close to finishing (42 minutes). I'm guessing all the tests would take about 50 minutes on the PowerBook. There are currently 21 AppFuse combinations tested by this script. Spring is used in all of these, so I've eliminated that as a listed option.

NOTE: If you're trying this on Windows, remove the "fixcrlf" call at the beginning of the "test" target.

  1. Struts + Hibernate
  2. Struts + Hibernate and iBATIS
  3. Struts + iBATIS
  4. Struts with AppGen - Generic
  5. Struts with AppGen - Detailed
  6. Spring MVC + Hibernate
  7. Spring MVC + iBATIS
  8. Spring MVC with AppGen - Generic
  9. Spring MVC with AppGen - Detailed
  10. WebWork + Hibernate
  11. WebWork + iBATIS
  12. WebWork with AppGen - Generic
  13. WebWork with AppGen - Detailed
  14. JSF + Hibernate
  15. JSF + iBATIS
  16. JSF with AppGen - Generic
  17. JSF with AppGen - Detailed
  18. Tapestry + Hibernate
  19. Tapestry + iBATIS
  20. Tapestry with AppGen - Generic
  21. Tapestry with AppGen - Detailed

So, the question is - can your machine run all the tests for AppFuse? If so, let me know your specs. I'd love to get this setup for CruiseControl, but if I can't even run it with Ant, I doubt CruiseControl will be any better. I realize I could split things up, but I prefer to have one build file.

Posted in Java at Dec 10 2004, 08:51:02 AM MST 8 Comments

Pick the web framework you think is cool

Ever since I started adding additional web frameworks into AppFuse, people have asked me "which framework should I use?" I've often told them "use what you know." If you have in-house knowledge of Struts, use it. I thought this was good advice because I believed that existing knowledge leads to greater productivity.

Lately, I've started to change my philosophy. I'm starting to think it's more important to use the web framework you're passionate about. The one you want to learn more about. After reading Kathy Sierra's "Does it really matter if your tool is cool?", it seems this is a good idea. She writes:

Coolness (or just perceived coolness, it really doesn't matter) is linked to passion. The cooler you perceive your tools to be, the more passionate you are about those tools. And passion, while it might lead to the "everything is a nail" syndrome, has an extraordinary amount of value!

Obviously there's quality of life... a life with passion is certainly more fun than one without. And the more passion, the greater the chances that a person has what psychologists label optimal experiences. And the more optimal experiences one has, the more likely one is to describe life as being "happy". So, passion = optimal experiences = happiness. And research says happy people are generally more productive. Certainly they're more spirited and fun to be around...

So I guess passion leads to greater productivity, not existing knowledge. So which web framework do you think is cool? Which one are you passionate about?

If I had to choose based on my passionate choice, and the one that I think is the coolest, I'd have to go with Tapestry or possibly JSF (JSF would be a lot cooler if it let me put my JSPs in the WEB-INF directory instead of in the root). These are the frameworks I want to learn more about. 6 months from now? Maybe Laszlo or JDNC.

Posted in Java at Dec 09 2004, 04:47:25 PM MST 17 Comments

JSP and JSF Early Review Drafts Available

The Early Draft Reviews are now available for the new JSP and JSF specifications. Read More ».

Posted in Java at Dec 09 2004, 02:44:51 PM MST Add a Comment

Speaking at MySQL Users Conference

Looks like I'll be speaking at the MySQL User Conference in April 2005. This conference is at the Santa Clara Convention center, where SD West was last year.

Congratulations! You have been accepted as a presenter for
the MySQL Users Conference 2005 at the Westin Santa Clara, Santa Clara,
California, April 18, 2005 - April 21, 2005.

The following has been accepted as a 3 hour tutorial class for the
event:

"Developing Test-Driven Web Applications With Spring and Hibernate"

The tutorial classes are scheduled for Monday, April 18, and we will
send the exact time schedule shortly.

They wanted a fancier title than all the AppFuse ones I had cooked up - that's why it's titled Developing Test-Driven Web Applications With Spring and Hibernate. Now I just need to figure out what kind of app to develop in 3 hours. With AppGen and AppFuse Generator, it takes a lot of fun out of the development process. Or maybe it puts the fun back in?

If there's a JUG nearby that'd like to know a bit more about AppFuse or Spring, let me know.

Posted in Java at Dec 09 2004, 02:21:52 PM MST 1 Comment

[DJUG] JMS and Spring

Tonight's DJUG should be a fun one. First, I hope to learn some JMS tips and tricks from Chris Huston then I'm doing a presentation on Spring. I asked the group what they wanted to know about Spring last week and I got a wide range of answers. There should be a good mix of newbies and experienced Spring users. I'll give you a link to my presentation, but I have to warn you that there's not much there. I tend to show a lot of code in and do demos when I present, so my presentations tend to be kinda thin. My two goals for tonight are 1) keep it under an hour so we can all get to the bar and 2) inspire Spring-mania among the crowd.

   Download Presentation »

Posted in Java at Dec 08 2004, 05:00:51 PM MST 6 Comments

[ANN] AppFuse 1.7 Released

This release adds support for JSF/MyFaces and Tapestry as web framework options. AppGen has been updated to work with both of these frameworks and I added new tutorials as well. You can read about my integration experience in a previous post.

After I released AppFuse 1.6.1, I knew the only way I was going to get Tapestry and JSF support done was if I stayed close to the code and started the next release. I never envisioned developing the Tapestry and JSF versions of AppFuse at the same time, but it turned out to be very efficient. If you want a comparison of all the different web frameworks in AppFuse (and AppFuse Light) - you can checkout my Comparing Web Frameworks presentation. If you want more in-depth coverage - it'll be in the next Chapter of Spring Live. ;-)

If you find any issues, let us know.

Posted in Java at Dec 08 2004, 11:30:25 AM MST 9 Comments

Integrating JSF and Tapestry into AppFuse

Well it looks like I accomplished my goal for the year: integrate Spring MVC, WebWork, Tapestry and JSF into AppFuse. I decided to integrate JSF and Tapestry at the same time so I could get a good feel for their differences. Also, I figured there would be a lot of similarities I could re-use between the two. I found this to be a great idea. Often I'd use the first framework as a template and the second would go much quicker. It turned out to be a good strategy because I often found bugs in the first while working on the second. I really enjoyed developing with both JSF and Tapestry - here's my notes from my development marathon over the last week:

Tapestry

  • For Tapestry, I created a patched version of the 3.0 source. I did this because I wanted some non-standard things, like friendly URLs, a global properties file and a popup calendar that works with IE/XHTML. The Tapestry Community was gracious enough to supply the source - so I didn't have to do much patching myself.
  • Pure HTML, like Tapestry has, is ssoooooo much nicer to work with. The syntax highlighting in HomeSite is fully functional again! I've been an HTML developer since 94 and I felt like it was 97 all over again - when we didn't write apps, just static HTML.
  • Overriding the default Tapestry ValidationDelegate was pretty easy - and there's even an example in Tapestry in Action. I was able to add asterisks for required fields and error messages next to the fields fairly easily. Erik Hatcher also hooked me up with a Label component for non-validating fields.
  • For the contrib:Table component, you can easily i18n column headings by using "keyName:propertyName" as the column value. However, if your keyName has a period in it (i.e. user.username), you can't override the ValueBlock b/c user.username is an invalid OGNL expression. I patched Tapestry to solve this.
  • The ability to use <span key="keyName"/> to render i18n keys is awesome. So simple.
  • Tapestry has a very rich validation framework that requires virtually no configuration. No setting up your resource bundle, etc. It just works. Client-side too.
  • It would be nice to show all the client-side validation errors in a single dialog instead of one-at-a-time (WebWork does this too).

JSF/MyFaces

  • I like how you don't have to create mappings - just link to the .jsp with an .html extension.
  • For some reason, when I save a user and server-side validation occurs, the user's username and roles disappear. Good thing client-side validation is available.
  • It was easy to override the Labels to add asterisks thanks to some code from David Geary on the MyFaces mailing list. In order to make it work, I had to ditch my HTML <table> and use an <h:panelGrid>. Now my JSP is Tag Soup. I think JSF is going to have to ditch JSP if they want to get anywhere. Hopefully JSF will soon support HTML templates like Tapestry and parse them with a Servlet Filter or something.
  • It's unfortunate that I have to specify a "styleClass" attribute on all my <h:message> tags - I'd like to just set a default for these tags (others too).
  • I ditched JSF's message setting and opted for setting my own List of messages in the session and then grabbing them out with a MessageFilter. This was so much easier to implement than the standard JSF message setting stuff.
  • I'd rather not have to specify <f:loadBundle> at the top of each page. It's going to be the same for my whole app - it'd be nice to set a default bundle and variable name that all tags could access.
  • It was quite a bit easier to integrate JSF into AppFuse than Tapestry. This was mainly due to the fact that I could re-use a lot of the JSP code, as well as the WebWork Actions are pretty close to the JSF Managed Beans.
  • Spring Rocks - it never caused any issues with either framework. I just wish MyFaces wouldn't warn that it can't find a variable that it's already found. I had to turn logging down to FATAL so I don't get any meaningless messages from MyFaces.
  • With JSF, why do I have to specify the supported locales in faces-config.xml? Why can't it look up the available bundles like JSTL with Spring/WebWork/Struts does?

So after all of this, which is my favorite? Unfortunately, there is no clear winner. They're both pretty cool, but not that much better than Struts, Spring or WebWork. In reality, I like them all, that's why they're all integrated into AppFuse! ;-)

Update: I forgot to mention that I was very pleased with the latest version of Canoo's WebTest. It now uses HtmlUnit at its core and its JavaScript support has vastly improved. I wouldn't have been able to do integration testing on the JSF version without this (updated) library. Not only did it work great, but it found XHTML issues in my code - that rocks! The JSF and Tapestry versions of AppFuse are the only ones that run Canoo tests with JavaScript turned on. This is mainly because the old tests worked fine w/o JavaScript and I didn't want to break them.

Posted in Java at Dec 08 2004, 04:10:27 AM MST 5 Comments

The Future of the J2EE Web Tier

There's a chat in a few hours on the future of the J2EE Web Tier. I'll be sitting in and hoping to learn something. The alignment of the JSP EL and JSF EL will be nice - but we really want HTML Templating for JSF - like Tapestry. After developing Tag Soup JSPs for JSF and HTML-editor-friendly pages for Tapestry, I can say there's definitely a big difference. Tapestry templates are much easier to read. However, if you have an existing JSP app, you can migrate to JSF easier.

Posted in Java at Dec 07 2004, 09:30:02 AM MST 7 Comments

AppFuse - Tapestry and JSF Support in CVS

I've finished the coding part of adding JSF (MyFaces) and Tapestry support to AppFuse. This weekend was spent knee-deep in XDoclet templates - updating AppGen for these two frameworks. I still need to write up a couple of blog posts about integration and update the tutorials, but the hard part is done.

If you're an early-adopter, feel free to check it out. The QuickStart Guide should help you get the source from CVS. I hope to release version 1.7 later this week.

Posted in Java at Dec 06 2004, 05:43:00 PM MST 2 Comments