Matt RaibleMatt Raible is a writer with a passion for software. 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.
You searched this site for "framework". 558 entries found.

You can also try this same search on Google.

[JavaOne] State of the Web Tier

I'm sitting here with Bruce, listening to Craig McClanahan and others speak about the "state of the web tier." After the first 15 minutes, it seems like a waste of time. I should go to something I don't know about. The first 15 minutes touched on MVC frameworks and things like filter and tag libraries. I was impressed that they mentioned WebWork, Tapestry and Spring. Heck, they even mentioned SiteMesh when they talked about filters. Now Craig is talking about portlets.

It would be cool to do some portlet development. I took a class a couple of years ago to become a Portal Server instructor. I got certified, but never actually taught a course.

JSF: A server-side user interface component framework for Java technology-based web application. It's not an application framework for your business logic - it's for the UI only. JSF looks cool - especially since it uses the same "form backing object" like Spring MVC has. I think JSF has an advantage over a lot of other frameworks because (1) it'll be well documented and (2) it'll be well tested and (3) it'll be widely used. Having a widely-used technology is sooooo much easier to learn than ones that aren't. I'm willing to bet that the JSF version of AppFuse will be the most popular one in a year from now. By the end of the year, AppFuse will support WebWork, Tapestry and JSF in its web layer - in addition to Struts and Spring MVC.

Demo time. Craig is showing us the JSF demo app that we saw in the keynote. We're looking at Java Studio Creator now. There's a Creator party tomorrow night - get tickets from downstairs at the Creator booth.

J2EE 5.0: New name, same great platform. Final release in second half of 2005. Ease of Development is the primary theme. Based on J2SE 5.0, with great benefits (shouldn't it be J5SE and J5EE - WTF!?). New JSRs: JSP 1.2/JSF 1.2 - EL alignment is key. Toolability is key. Maintenance reviews: Servlets and JSTL. J2EE.next - successor J2EE 5.0. Work will begin shortly after JavaOne and JSRs will be filed after JavaOne. Experts groups are on Java.net - JSP and JSTL are there today. Also,the JSF Reference Implementation is now on java.net. BTW, I'm on the J2EE 5.0 Expert Group so hopefully I can contribute to making J2EE 5.0 easier too. They'll let just about anyone onto these expert groups - can you believe they let both Hani and I in? ;-)

Posted in JavaOne at Jun 28 2004, 03:29:35 PM MDT 5 Comments

Using JAAS with Tomcat

Want to use JAAS with Tomcat? If so, you might want to checkout this Using Tomcat with JAAS tutorial.

Although it is possible to use JAAS within Tomcat as an authentication mechanism (JAASRealm), the flexibility of the JAAS framework is lost once the user is authenticated. This is because the principals are used to denote the concepts of "user" and "role", and are no longer available in the security context in which the webapp is executed. The result of the authentication is available only through request.getRemoteUser() and request.isUserInRole().

This reduces the JAAS framework for authorization purposes to a simple user/role system that loses its connection with the Java Security Policy. This tutorial's purpose is to put a full-blown JAAS authorisation implementation in place, using a few tricks to deal with some of Tomcat's idiosyncrasies.

Personally, request.isUserInRole() usually does everything I need. If I need something more than that, it's usually pretty easy to add some custom logic. Of course, if I ever need anything super robust, I'll probably use the Acegi Security System for Spring.

Posted in Java at Jun 03 2004, 10:30:27 AM MDT 3 Comments

[ANN] AppFuse 1.5 Released!

I finally found time to fix a few minor bugs in AppFuse 1.5 Beta and update all the tutorials. Now there's 3 new HowTos for developing a Master/Detail page using Spring's MVC Framework. After writing the tutorials, I found a new appreciation for Spring's MVC. I really like its lifecycle and (if given the opportunity) I think I'll use it for my next project. Without further ado, here's the relevant links:

Enjoy!

BTW, if you live in Colorado and you want to learn more about AppFuse, Spring and AppFuse Light - stop by the Denver JUG on June 9th or the Boulder JUG on June 10th. I'll be talking at both events. As a teaser, here's the bullet points from my slide on AppFuse Light:

  • Designed for quick apps with few requirements (i.e. prototypes)
  • Uses Sitemesh for skinning
  • No build-time dependencies (i.e. XDoclet), no out-of-the-box security
  • Web tests do not depend on container
  • All code can be easily ported to AppFuse if you need AppFuse features (i.e. security, i18n, gzip compression)
  • Simpler, lighter, faster (for building and testing)

Posted in Java at May 27 2004, 04:18:08 AM MDT 8 Comments

[NFJS Denver] David Geary and Advanced JSF

David is going to cover some JSF advanced topics: data table, tiles integration, custom components and validators. I was talking with Rick Hightower last night. He mentioned that he's been doing a fair amount of work with JSF lately and really likes it. He actually said he thinks he can develop a webapp faster with JSF than he can with Struts. He also said that JSF ships with a lot of what you need - and a lot of the JSF books seem to cover how to add new stuff (custom components and validators) you don't need. This is to say that the books tend to cover the features of JSF, rather than how to develop successful projects with JSF. I said I thought it'd be nice if there were some JSF books by folks who'd used it to deliver applications. More of a "here's what you need to know" kindof manual. I think that's what JSF needs.

The <h:dataTable> in JSF is pretty much the same as the <c:forEach> tag in JSTL. An interesting note on the JSF expression language - it starts with a # instead of a $. For example:

<h:dataTable value='#{tableData.names}' var='name'>
...
</h:dataTable>

The major difference between JSF and JSTL's expression language is that JSF EL can access managed beans. The JSP 2.0, JSTL and JSF expert groups are going to work together to try and synch up their expression languages. Personally, I don't see why the JSF folks didn't just use JSTL and simply include managed beans in the lookup logic. Here's a wierd one - if you use any "template text", i.e. in a dataTable - you have to wrap the text with <f:verbatim>text</f:verbatim>. David says this is one of the embarrasing things about JSF. He hopes it'll be fixed in the next version.

The <h:dataTable> looks very similar to the DisplayTag. Sweet - that's one less thing I'll have to worry about when creating a JSF app. I've said it before and I'll say it again - my two favorite tag libraries are the DisplayTag and Struts Menu. As I'm learning new frameworks, one of my major goals is to reproduce the same functionality I enjoy in my Struts+JSP apps. It's been pretty simple so far with Spring and WebWork, since both support JSP. However, it might get a bit tricky with Tapestry and JSF. I'm sure it'll be possible (and hopefully easier) to reproduce this functionality, it's just a big unknown at this time.

"Form" beans in JSF are not like form beans in Struts. It's really just a class that doesn't extend anything and has action handler methods. An interesting point - the actionListener's value (which is really a class.methodName) can be any class in any scope OR it can be a managed bean. How about some code:

public class Form { 
    public void changeLocale(ActionEvent e) { 
        FacesContext context = FacesContext.getCurrentInstance(); 
        Map requestParams = context.getExternalContext(). 
                            getRequestParameterMap(); 
        String locale = (String) requestParams.get("locale"); 
        if ("english".equals(locale)) { 
            context.getViewRoot().setLocale(Locale.UK); 
        } else if ("german".equals(locale)) { 
            context.getViewRoot().setLocale(Locale.GERMANY); 
        } 
    } 
}

The major reason behind the FacesContext is to support Portlets. So rather than using a ServletContext or PortletContext, the FacesContext provides a level of abstraction. The underlying theme of JSF: To be as flexible as possible. This is to say that there are many ways to do things with JSF. I often think it's better to have less choices when learning a technology, but once you're versed in it - choices are great. I guess I just wanna know the best way to do things, not all the options. Actions are for business logic, ActionListeners are for UI logic. ActionListeners are always fired before Actions - in the event that you have an actionListener and an action defined for the same component. Listeners and Actions are really just methods on a class and they can actually both be in the same class. JSF is starting to appeal to me. This session has been one of the fastest so far - there's only 20 minutes left and it feels like it's flown by.

JSF ships with converters for dates and currencies out-of-the-box - cool! Now David is explaining about a custom CreditCard converter. This is what Rick was talking about last night. Why do we need to know this stuff? Would a normal talk on another MVC Framework talk about converters and validation? I bet not. I think it's a good topic - maybe something that other frameworks should cover more visibly. The Converter interface has two methods: Object getAsObject() and String getAsString(). The Validator interface has one method: void validate(FacesContext context, UIComponent c). I just asked David about using Commons Validator instead of JSF's core validator. He said, "Yes, it's possible." Sweet! You can use Commons Validator with Struts, JSF and Spring! Now if we could only get support for it in WebWork and Tapestry - then I'd eliminate my need to learn another validation engine.

Now David is talking about using Tiles with JSF. It looks as simple as using the <tiles:insert> tag to insert dynamic content into an <f:subview>. Any time you insert a tiles component, you need to wrap it in an <f:subview> tag. That was short - we're done talking about Tiles. I had some questions - i.e. can you refer to a definition directly from an action or in the action's navigation definition? Oh well, onto custom components and renderers. Custom components and renderers seems to me to be something that should be left out of these types of presentations. Sure, it's cool they're possible - but who's using them? Have you needed them in a real-world JSF application? I only want to know the things I need to know to develop a real-world JSF webapp. Sorry, I forgot - there aren't any real-world webapps written with JSF. If I'm wrong - send me a link. ;-)

This presentation was good - it inspires me to learn some more about JSF. Maybe there'll be some projects in my next gig that require JSF - that would be wicked cool. After all, the best way to learn this stuff is to get paid to do it. If nothing else, I'll get to learn it later this year when I write AppFuse's web layer in JSF.

Posted in Java at May 22 2004, 04:15:13 PM MDT 2 Comments

[NFJS Denver] Ramnivas Ladded and Aspect Oriented Programming

For the 2nd session of the day, I've decided to attend the session on AOP. My choices were Converting XML (Ben Galbraith), JSF (David Geary), What's new in EJB 2.1 (Monson-Haefel) and Runtime Code Generation (Glenn Vanderburg). I asked David about his JSF presentation and he said it was "boring" so I decided to skip it. This session, in the first 10 minutes, is pretty boring too. I might have to duck out of this and attend another session - but none of the other sessions really interest me. This one started this morning, and it seems to be a continuation of this morning session. It's mostly on AspectJ and he's doing the good ol' logging example. I don't really have an interest in using AspectJ since Spring's AOP is more than adequate for my needs. Oh well, I guess I'll stick around and relax.

Ramnivas is using Eclipse to compile his aspects, and shows us how if he uses "javac" to compile everything, no aspects are added. I'm guessing that there's some sort of plugin for Eclipse that allows for easy compiling of aspects. A new feature in AspectJ 1.2 is the ability to set an ASPECTPATH and then use "aj" rather than "java" to run code. This achieves the same effect as compiling the aspects in Eclipse. The "aj" script appears to just set the system classloader.

Now Ramnivas is showing us how you can use an aspect to define pointcuts on internal appserver classes. His example involves WebLogic, the J2EE Petstore and logging any EJB method calls. To use this, he has to start WebLogic with a custom script, that has a custom classloader defined. For some reason, we're now talking about log.debug() vs. if (log.isDebugEnabled()) { log.debug() }. Ramnivas thinks that most folks don't wrap their debug statements (the proper way). Who doesn't know about this?! I'd like to think that most developers are writing the 3-line version vs. the 1-line version.

An interesting quote: "So many things to show you - 3 hours is not enough." Maybe if we didn't have to wait 2 minutes for WebLogic to start each time, 3 hours would be plenty. ;-) Ramnivas just added logging to all the classes in the blueprints packages and then reloaded the page. There looks to be several thousand method calls occurring behind the scenes for a simple page. Of course, there's lots of tag libraries - but still - PetStore is a ridiculously complex application. Why did some ever impose this crap upon us as "best practices" for Java. IMO, best practices should be based around simplicity, maintainability, testability and performance. Does the PetStore even ship with unit tests? I'll bet it doesn't...

Now we're watching a pretty cool demo where Ramnivas is using aspects to enforce coding policies. In this example, he's using aspects to enforce rules in EJBs (i.e. no static variables, swing or threads). It interesting in that the aspects actually prevent compilation and display errors defined in the aspect. It's a neat idea, but I'm suspicious in that a lot of this AspectJ stuff seems to be Eclipse-specific. What I mean by this is that Eclipse seems to be required for compilation. Is it easy to aspect-enhance your classes using Ant? I would hope so.

Ramnivas seems to be quite the AspectJ expert. He mentioned that he wrote a book for Manning and has mentioned a couple of his contributions to AspectJ in this presentation. I admire authors that write and contribute to projects at the same time. It's often an indicator that the person knows what the hell they're talking about.

This afternoon's first session choices are as follows: JSF Advanced Topics (Geary), Intro to J2EE Web Services (Monson-Haefel), JSR166 (Glenn Vanderburg), Rhythm (Brian Boelsterli) and GUI Development (Ben Galbraith). Web Services and Rhythm are 3 hour presentations, so I might stay away from those - that's just too long for me. Now that I'm sitting in the 2nd half of a 3 hour presentation - it seems that these sessions are best attended in the first half. It's almost as if the presenter is trying to find things to talk about in the second half. Or maybe AOP is just a boring-ass topic. ;-)

I'd like to go to Brian's talk on Rhythm, since he's a good friend and mentor of mine. But then again, I learned Rhythm from him - and use it daily - so I don't know that I'd get anything out of it. Advanced JSF looks good, maybe I'll go to that one. For the 2nd session this afternoon, I'll probably attend Howard's Creating Powerful Web Forms with Tapestry. Maybe I should stick with JSF and Tapestry and make it a web-intensive afternoon. Both presentations are even in the same room!

Posted in Java at May 22 2004, 12:29:31 PM MDT 4 Comments

[NFJS Denver] Richard Monson-Haefel and Groovy Programming

Groovy makes for easier for loops. As an example,

for (Iterator i = r.iterator(); i.hasNext();) {
    System.out.println(i.next());
}

... becomes ...

for (i in r) {
  System.out.println(i)
}

With Groovy, you can remove semi-colons and use dynamic typing. This means you can basically remove any types (i.e. List). The nice thing is that typing is a choice - you can use static typing like you do in Java write now.

One thing I forgot to mention about this conference. Jay Zimmerman (the organizer) has a pretty good idea. The full schedule is printed on the back of the conference badges attendees hang around their necks. This makes it very easy to find and decide what session to attend. I wish more conferences would do this.

Richard is going through closures, native list looping and how you can remove classes and method declarations. It seems to me that one of the coolest features of groovy is that all of the shortcuts are optional. This is huge IMO, because it means the developer has a choice - which is always nice. Richard says that in his experience, a program written in Groovy is about 1/5 the size of the same thing written in Java (an 80% reduction in code). Someone in the room asked about performance. I was surprised to hear Richard say that Groovy was a bit slower. After asking about this, it turns out that Groovy can be executed as a script or as native bytecode (if compiled first). So when Richard said "it's slower" - he meant the script version is slower - because it's interpreted - just like any scripting language.

Sweet - I just got a connection on the hotel's wireless network. I was in the midst of reading some RSS feeds in NetNewsWire and noticed a JRoller blog with additional coverage of this conference. ... Sorry, I got sidetracked for the last 20 minutes with the Spring developer's mailing list - talking about simplifying Spring forms in JSPs.

Back to Groovy. Richard, and several members of the audience, are talking about closures. I still don't really get what they are and why they're important. I guess I shoulda been paying attention. ;-)

Groovy has regular expressions built-in - based on JDK 1.4 Regex. In Groovy, == is the same as .equals() in Java. And === is equal to == in Java. Apparently, they did this because folks usually use == when they really want to get the functionality of .equals(). I like the idea that == in Groovy means the same thing as == in JavaScript, but I don't know how I feel about ===. I'm guessing that using .equals() is still possible.

Richard has a good presentation style. He does a lot of coding during his presentation - writing scripting, compiling and executing them. Unfortunately, since I got internet access, I haven't been paying attention as much as I should - but at least 75% of the class seems to be extremely engaged. An interesting thing about this conference vs. the MySQL Conference in Orlando. At MySQL, almost all the presenters had PC Laptops. In fact, I was one of the only ones with a PowerBook. At this conference, Bruce Tate is the first one I've seen that uses a PC. Almost all the presenters are using PowerBooks - mostly 15".

Groovy can be used for easily writing XML as well as enhancing your Ant build scripts. One thing I'm hearing at this conference, as well as seeing on blogs recently is that AppFuse's build.xml could probably use some refactoring. With Ant's new import feature and the ability to write scripts in build.xml - it's likely it could be greatly simplified. Then again, it ain't broke - so why should I fix it?

Richard's showing us how easy it is to write XML using Groovy's shell:

import groovy.xml.*;

x = new MarkupBuilder();
a = x.Envelope { Body("Hi")}

If you run this, you'll get:

<Envelope>
  <Body>Hi</Body>
</Envelope>

An interesting thing from the above demo. When Richard added "print a" as the last line in the script, it printed "Envelope" after the XML output. He said this is because the last line in Groovy is treated as the script output. That's kinda wierd IMO. GroovySQL - pretty cool and simplistic. A nice feature is that connections are automatically closed (when the script completes). Another thing Richard mentioned is that Files are also automatically closed - even when used inside an Iterator. It seems to me that Groovy is trying to stop many newbie Java developer mistakes, as well as do more automatic resource management (closing files and connection). This is actually similar to Spring in how its JDBC and ORM support manages closing connections behind the scenes. Good stuff - another tool to make life easier for Java Developers.

Posted in Java at May 22 2004, 10:34:13 AM MDT 7 Comments

[NFJS Denver] Bruce Tate and Intro to Spring

I decided to stay in the same room after Dave Thomas's talk and attend Bruce Tate's talk on Intro to Spring. After looking through the slides, I realized that its possible I won't learn anything new - but I think I'll stick around for a 1/2 hour or so - just to hear Bruce talk. At the beginning of his presentation, he asked if anyone has downloaded Spring. Hmmm - I'm the only one in a room of about 35. Bruce then mentioned Spring books coming out in the next few months. Damn, he didn't mention Spring Live - I guess I have some more marketing to do! Bruce calls Spring's ApplicationContext a "container", but it's not really a container, but a "dictionary of instantiated objects." That sounds like a good definition to me. Spring's mission statements, or basic beliefs:

  • J2EE should be easier to use
  • It's best to program to interfaces, rather than classes. Spring reduces the complexity cost of using interfaces to zero.
  • JavaBeans offer a great way of configuring applications
  • OO design is more important than any implementation technology, such as J2EE.
  • Checked exceptions are overused in Java. A framework shouldn't force you to catch exceptions you're unlikely to be able to recover from.
  • Testability is essential, and a framework such as Spring should help make your code easier to test.

I've been working with Spring for long enough that I've actually forgot about how much easier my J2EE development life is. This session is a good reminder of how cool Spring is. Poor suckers in this room - no one is even using it. Bruce is a good speaker - and looks quite a bit younger in real life (than in his pictures).

OK, I'm outta here - time to go learn some more about CVS. Note to self - talk to Bruce and figure out how he modified JUnit's excluded.properties file. He had to do this a few weeks back in order to get Hibernate's EHCache working with Spring in JUnit tests. I was able to replicate his issue, but never solved it myself.

Posted in Java at May 21 2004, 05:28:09 PM MDT 4 Comments

New JSPWiki Template - Springtime

I put together a new JSPWiki template this week - and I'm calling it "springtime" for now. I don't mean to reference "Spring" as in the Spring Framework, but rather Spring as in a fresh, crisp look. A lot of the styles I actually took from my Struts Resume stylesheet. For a demo, I've replicated my current wiki onto my demo server and changed the template to springtime. Whaddya think? Do you like it better than the "Redman" template I'm currently using?

Feel free to download either of these templates: Redman · Springtime

Posted in Java at May 21 2004, 06:04:17 AM MDT 3 Comments

XDoclet vs. JSR 175

Rob Kischuk has a post where he describes what a Struts Action might look like using JSR 175 annotations.

@StrutsAction(
  @ActionMappings({
    @ActionMapping(
      path="index"
      @ActionForwards({
        @ActionForward(
          name="success"
          path="index.jsp"
        )
        @ActionForward(
          name="failure"
          path="error.jsp"
        )
      })
    )
  })
)
public class IndexAction extends Action {

As I read it, I though - "holy crap is that ugly!" Isn't the XDoclet version a bit cleaner?

 * @struts.action path="index"
 * @struts.action-forward name="success" path="index.jsp"
 * @struts.action-forward name="failure" path="error.jsp"

I'll admit, I don't know much about JSR 175, except that it is designed to replace XDoclet. However, I don't believe that it will generate code like XDoclet does - but rather it will allow your Java code to describe metadata using doclet tags. So what good does that do? Does this mean all my metadata and configuration stuff is hard-coded into my source? With XDoclet, I realize that a lot of this stuff is hard-coded into my source, but at least I can change things by changing an ant property and rebuilding - or changing the generated XML files. Why is JSR 175 better than XDoclet? I guess I just don't see the beauty of it. More typing and uglier javadocs aren't that appealing to me.

Posted in Java at May 19 2004, 11:12:29 AM MDT 7 Comments

[ANN] AppFuse 1.5 Beta Released!

This release has lots of modifications that I've been meaning to make for quite some time. Specifically (1) removing the dependency on j2ee.jar and (2) removing Struts from the services layer. I also made improvements to Spring and its context file loading so you should be able to run unit tests from your IDE.

Other notables include full i18n support (with translations in Dutch, Brazilian and Chinese), improved setup-tomcat target (no additional JARs needed now), and an option to use Spring's MVC framework instead of Struts. If you'd like, you can read more about my conversion from Struts to Spring. Enjoy!

BTW, this upload was a little hefty for java.net at 12.5 MB - because of the iBATIS and Spring MVC option. My browsers (Mozilla and IE) kept timing out and I was getting a "Not enough space" error. To fix this, I had to increase the timeout on Mozilla. Here's the steps I went through:

  • Type "about:config" in the address bar.
  • Type "timeout" in the filter field and hit Enter.
  • Change "network.http.keep-alive.timeout" to 600 (10 minutes). The default is 300.

Posted in Java at May 04 2004, 03:57:41 PM MDT 10 Comments