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 "servlet". 226 entries found.

You can also try this same search on Google.

Seam 1.0

I've posted my thoughts on Seam 1.0 to my Virtuas blog. What are your thoughts?

It's great to see the release of Seam 1.0. Seam is similar to many full-stack frameworks like Rails, Rife and AppFuse in that it gives you all the pieces you'll need to build a kick-ass web application.

I've blogged my thoughts on Seam before, so there's no need to do that again. I like the idea, especially the lack of interfaces and the 3-files-for-each page idea. However, I don't know that this concept will fly with Java developers. I agree there's a need to simplify, but many of us are mesmerized by the de-coupling that Spring gives us. So now we're programming to interfaces, and every-so-often swapping implementations. I don't know that we can switch to this simpler model. And then there's the "EJB" thing. I think there will be a fair amount of developers that don't use EJB3 simply because it has the "EJB" name. The best thing the EJB Expert Group could have done for EJB3 would be to give it a new name.

The other thing I worry about with Seam is that it wasn't developed from an existing application. AFAIK, it didn't get extracted from a real-world application that had all the problems that Seam solves. I know that Gavin is a smart guy, and he's probably seen these problems in the real world, but there's nothing like developing a real-world application with a technology - and then extracting the framework from that.

In reality, I'm probably jealous. Seam has some really cool features, JBoss has done a great job of marketing it, and it seems to be a really cool way to develop applications. If I'm going to make AppFuse a direct competitor to Seam, it's gonna be quite the uphill battle.

Posted in Java at Jun 13 2006, 04:45:48 PM MDT 5 Comments

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

Gig in Seattle

I don't normally post gigs on this site, but I do when they're good rates, and the person hiring is a friend of mine. Here's one in the Pacific Northwest (Seattle):

  • 5+ years of experience with Java and J2EE required including EJB, JMS, and JSP/Servlet, required.
  • 3+ years of experience with UML, SOAP, XML/XSL, SQL, Struts.
  • 1+ years experience working with external client on projects.
  • Experience applying design patterns and OO best practices required.
  • Experiencing writing use cases and producing design documentation required.
  • Experience developing on Unix platforms required, preferably RedHat Linux.
  • Required application experience: BEA Weblogic, Tomcat, Apache.
  • Desirable application experience: Maven, Struts, Spring, MySQL, Oracle.
  • Desirable methodology experience: Refactoring, Agile, Scrum.
  • Desirable additional skills: WML, WAP, XHTML, XSL, XML Schema, SSL, HTTP, Perl.

Let me know if you're interested and I'll forward you the full job description and contact person's information.

Posted in Java at Apr 25 2006, 03:21:07 PM MDT Add a Comment

[TSSJS] Java Web Frameworks Sweet Spots BOF

I've finished composing my "Java Web Framework Sweet Spots" document and presentation for tonight's BOF at TSSJS. Unfortunately, the BOF is at 6:30 and Crazy Bob's wedding is at 6. So I won't be able to make it to the wedding, but I do hope to have a toast to Bob and his new bride. I have been successful in securing beer for the BOF, so you'd better get their early if you want a free one. Caesar's doesn't have kegs, so it's $6/beer and we've purchased 100 of them for attendees. After that, it turns into a cash bar. Thanks to Virtuas, Codehaus, SourceBeat and yours truly for pitching in for the free booze.

My presentation tonight will be short and sweet. Rather than going through each framework author's responses, I'm just going to highlight their "sweet spot" responses. This allows me to get away with creating a measly 8-page presentation, as well as have a more interactive session. I've taken everyone's responses to the 6 questions I asked, and compiled them in a document. This document is available on the Virtuas site, just click on the link below to download it.

» View Java Web Framework Sweet Spots

Posted in Java at Mar 24 2006, 05:27:24 PM MST 28 Comments

[TSSJS] Friday Morning: RIFE and Seam

This is my 2nd day in Vegas and so far this town is treating me fairly well. I haven't lost all of my money, but the $25/hand blackjack tables haven't been kind. Yesterday, I woke up with a glass full of Berocca next to my bed - which means I passed out before drinking it. I needed it too, Matt Filios won a poker tourney and a bunch of us enjoyed "bottle table" (with Kettle One vodka) to celebrate. Spendy and good, but painful the next day.

Last night, I heard it was Crazy Bob's bachelor party, so I went to bed early to avoid the debauchery. Julie and a good friend of mine are flying in tonight, so there will be plenty of that this evening. So after a good night's sleep, I'm up early and attending the conference. The first hour has a lot of good sessions: Introduction to Seam (Gavin), Dive into RIFE (Geert), OSWorkflow (Hani) and Transforming Enterprise Java into a Commodity (Geir).

I'm sitting in Geert Bevin's session titled "Dive into RIFE" and it's a pretty small audience - maybe 20 people. Geert is the CTO of Uwyn, a small custom application development company. He's the founder of RIFE and creator of many RIFE projects: RIFE/Crud, RIFE/Jumpstart, RIFE/Continuations, Bamboo (forum), Bla-bla List (RIA todo list), Drone (Information bot) and Elephant (blog).

What is RIFE? It's a full-stack component framework to quickly and consistently develop and maintain Java web applications.

  • Integrated layers allow you to quickly get results with a minimal amount of code
  • Best practices are enforced in a pleasant way, providing many additional features and a consistent approach throughout all applications
  • Components can easily be resused in many contexts
  • Creating maintainable applications is our first goal
  • A lot of attention goes to code-level developer comfort
  • Frustration reduction by instant changes and reloads
  • Creative solutions for difficult problems
  • Embraces established standards (XHTML, HTTP, SQL, ...)
  • Geared to developing web applications and doesn't abstract away too much
  • Everything besides the web engine is designed to be independently usable
  • Attention to the whole life-cycle of your application

Geer is now talking about all the different pieces of RIFE - how it has a JDBC abstraction like Spring JDBC, web services support (even publishing of RSS Feeds) and a content management framework. Now we're going to look at RIFE/Jumpstart.

What is RIFE/Jumpstart? It's a source archive that you unzip and run. It makes it easy to start with new RIFE applications and contains everything you need (including Jetty). It has immediate support for more common development environments (X-develop, Netbeans, Eclipse, IDEA and Ant). Geert just showed us a video of getting started with Jumpstart and how you can easily use X-develop to build and deploy the app to Jetty. The Jumpstart application currently uses JUnit, but since the RIFE teams is starting to use TestNG more and more, it's likely they'll change in the near future. RIFE Jumpstart looks similar to AppFuse, except they have the save+reload problem solved - using JVM HotSwapping.

Now I've moved to the Introduction to Seam session. Gavin King is the presenter and the room is packed. It's a big room, so that's saying a lot. Gavin is talking about JSF, how backing beans work and what's in the faces-config.xml. How does Seam compare to J2EE? Much simpler code. There's fewer artifacts (no DTOs). Less noise (EJB boilerplate, Struts boilerplate). More transparent (no direct calls to HttpSession or HttpRequest). It's also much more powerful for complex problems.

JSF is amazingly flexible and extensive. EJB interceptors support a kind of "AOP lite" and EJB3 is a powerful ORM engine. Everything (except for the JSP pages) is unit testable can be tested with JUnit or TestNG. For testing the view layer, Gavin recommends using Selenium.

A backing bean is often "pure glue" and is just noise. Furthermore, it accounts for more LOC than any other component. It doesn't really decouple layers, in fact the couple is more coupled than it otherwise would be. Gavin calls this "wedding cake architecture." These applications look good in the window, but don't taste good when you eat them. I get his point, but have to disagree on the taste of wedding cake. It's always been good at the wedding's I've attended. ;-)

By default, web applications in general do not work in a multi-window application. To make it work, it generally requires a major architecture change. A couple of other areas for improvement in traditional web applications: application leaks memory (not cleaning up session objects) and "flow" is weakly defined. Navigation rules are totally ad hoc and difficult to visualize. How can this code be aware of the long-running business process?

JBoss Seam - what does it do? It unifies the EJB3 and JSF component models. It simplifies Java EE 5, filling a gap. In addition, it integrates jBPM and makes it more developer-friendly. Deprecate so-called stateless architecture. Decouple the technology from the execution environment. Run EJB3 apps in Tomcat or in TestNG or use Seam with JavaBeans and Hibernate. Gavin is using Tomcat for the first time and thinks it's hot-deploy architecture is totally broken. Of course, he usually uses JBoss and never has a problem with hot-deploy. It's interesting to hear this from Gavin, especially since I've heard from others that Hibernate breaks the reloading - and it's not the server's fault.

I'm going to head to another session now, but I did look ahead at some of Gavin's slides. Interestingly enough, the jPBM pageflow definition's XML looks quite similar to Spring Web Flow. Speaking of flows, I heard an interesting comments from someone yesterday after they attended Geert's continuations talk. Apparently, after seeing his talk, they think that RIFE's continuations offer a much more elegant solution to pageflow than these "XML programming" mechanisms.

I tried to go to Hani's OSWorkflow talk, but he was doing Q&A when I walked in. Apparently, he finished 25 minutes early. Then I walked into Geir's talk only to find Dan Deiphouse finishing up an XFire talk. Oh well, there's nothing wrong with having a few minutes to mingle between talks.

Posted in Java at Mar 24 2006, 11:56:30 AM MST 7 Comments

Using JasperReports with AppFuse and Spring MVC

JasperReports LogoIt's been over a year since Gilberto wrote a message to the mailing list about how to use JasperReports with AppFuse's Spring MVC flavor. Now he's created a tutorial for how to use JasperReports in AppFuse. Thanks Gilberto!

I've seen a fair amount of howtos for Spring MVC + JasperReports. I've even written one myself as part of Chapter 6.5 in Spring Live. However, I haven't seen many articles detailing how to integrate JasperReports with other Java web frameworks. Are they out there and I'm just not seeing them? It'd be great if we could show how to integrate JasperReports with all the web frameworks that AppFuse supports.

Posted in Java at Mar 22 2006, 07:46:58 AM MST 6 Comments

Jetty 6 Maven Plugin now works with SiteMesh (and Equinox)

The 1.6 version of Equinox contains commented-out settings for Maven 2 Jetty Plugin. The reason these are commented-out is because this plugin didn't work with SiteMesh at the time. I checked again today, and it looks like they got it fixed. See Brett's post titled Developing with Jetty: Where Have You Been All My Life? to see why this plugin is so cool.

Using this plugin (or the JettyLauncher in Eclipse) makes it pretty damn easy to do develop Java webapps. There's no longer a deploy cycle, just save and refresh your browser. IMO, it's almost as good as using a scripting language or developing with HTML/CSS/JavaScript.

I'd love to see someone develop a TomcatLauncher, a WinstoneLauncher and Maven 2 Plugins for both. AppFuse works with Winstone 0.8.1 (a wicked fast servlet container with a good story behind its name).

In other Jetty news, Jan Bartel posted a nice tutorial today titled How To Use JOTM as the XA Transaction Manager in Jetty6.

Posted in Java at Mar 10 2006, 12:08:31 PM MST 4 Comments

Updated Web Tier Specs for Java EE 5

Ed Burns (JSP Spec Lead) points out there's New Drafts of Java EE Web Tier: JSF 1.2, JSP 2.1, Servlet 2.5

I'm pleased to announce another revision of the Java EE Web Tier. In Jan Luehe's blog you can find out what's new in JSP 2.1 Proposed Final Draft 2 (PFD2). The Change Log for Servlet 2.5 will give you the scoop on the Servlet spec. This blog entry will show what's new in the JSF spec.

In JSF, the most visible new feature since the last draft of the spec is the addition of the invokeOnComponent() method on UIComponent. See below for more details.

This revision of the Java Web Tier is fully implemented in glassfish build 37, Sun's open source Java EE 5 Application Server, and the basis for the upcoming Java EE SDK.

I changed the link to Jan Luehe's blog because Ed's link seems to be incorrect. My guess is Java EE will be finalized and released before JavaOne. This is how Sun usually does things: work like mad until JavaOne, then take a week or two off to celebrate the release. Other rumors I've heard are that JBoss and Geronimo hope to release Java EE 5 compliant releases by or at JavaOne.

2006 is shaping up to be quite a year for the popular Java web frameworks. Tapestry 4.0, WebWork 2.2, JSF 1.2 and Spring MVC 2.0 (with form tag libraries and smart defaults). The question is, how long will it take for MyFaces to implement JSF 1.2? And when will we see a large-scale site deployed with JSF?

Why isn't Struts or your favorite framework in this list? Struts is being replaced by WebWork and the rest simply don't have the market share. No one has heard of RIFE or Wicket. However, that didn't stop me from encouraging SourceBeat to publish a Wicket book. Having good (published) documentation about a project is the first step to corporate adoption IMO.

Posted in Java at Feb 17 2006, 11:06:34 AM MST Add a Comment

How to use Tiles with WebWork

This evening, I created a TilesResult for WebWork that allows you to use Tiles with WebWork. For the following to work in your application, you'll need a nightly build of Tiles, commons-digester (which Tiles requires) and this patch for WebWork. For your convenience, I've posted a patched webwork-2.2.2.jar (with TilesResult).

I also posted a webwork-tiles.war that you can try and download yourself. It's based on Equinox, so you will need to setup PostgreSQL and an "equinox" database - or you can just change the database settings in WEB-INF/lib/jdbc.properties.

On to the instructions:

1. In your web.xml file, you need to add a servlet entry for TilesServlet to load the tiles definitions into the ServletContext.

    <servlet>
        <servlet-name>tiles</servlet-name>
        <servlet-class>org.apache.tiles.servlets.TilesServlet</servlet-class>
        <init-param>
            <param-name>definitions-config</param-name>
            <param-value>/WEB-INF/tiles-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

2. In xwork.xml, use type="tiles" on your <result>.

    <action name="editUser" class="userAction" method="edit">
        <result name="success" type="tiles">userForm</result>
        <result name="input" type="tiles">userList</result>
    </action>

I'm sure WebWork has a way of making this result type the default, I just haven't found it yet.

Hat tip to Spring's TilesView (source) for showing how to make this work.

Update: While I'm a happy SiteMesh user, I've recently had some clients who were more interested in Tiles. This largely inspired me to see if WebWork + Tiles was possible.

Update 2: It looks like TilesResult will be included in WebWork 2.2.2. Now if we could just get the Tiles team to cut a release.

Posted in Java at Feb 16 2006, 01:08:42 AM MST 3 Comments