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 "jsps". 109 entries found.

You can also try this same search on Google.

My JSF Experience

Of all the MVC Frameworks I've developed with in the last few weeks (Struts, Spring MVC, WebWork and Tapestry) - JSF was by far the worst. And it's not the implementations that are the problem, it's the spec itself (as far as I can tell). Plain and simple, it does not simplify web development.

I spent 3 days developing a simple JSF app - most of it which I had done in the first day. The last 2 days have been spent migrating to MyFaces and trying to find clean ways to do things. My perspective on JSF after this experience? Run away. Run far, far away. All of the above mentioned frameworks are MUCH superior to this technology. Let's get on with the things I learned.

  • MyFaces handles duplicate posts nicely. If you hit "reload" on your browser after saving a record, you get presented with an empty form rather than a duplicate record. I believe I got a duplicate record with Sun's RI.
  • The ability to specify an "action" attribute on a button (or a link) and them map that action to a page (in faces-config.xml) is pretty cool.
  • Every button or link clicked results in a form post. That's just wrong - why can't I have true links like the web is supposed to? So much for bookmarks.
  • Saving state on the client results in enormously long URLs and/or hidden fields.
  • JSF support is fairly non-existent. Unlike the other MVC frameworks, the MyFaces mailing list has hardly any traffic and the Sun forums aren't much better.
  • The MyFaces website seems to be down whenever I want to look something up on it, like right now.
  • I did find some CRUD examples, like this this one, but was disappointed to find that i18n is not considered for setting success messages. I ended up using the solution described in this post. 6 lines of code to set a success message - you've got to be kidding me! Most frameworks have a simple 1-2 liner.
  • Waiting for JSPs to compile the first time has surprisingly become painful after using Tapestry, Velocity and FreeMarker for the last 2 weeks.
  • Integration with Spring is fairly easy (code is in CVS), but MyFaces spits out an error when it shouldn't be.
  • Validation messages are ugly. For instance, when a required field isn't filled in, I get: "lastName": Value is required. I was able to override the default messages, but I was never able to use the label of the field (vs. the field's id).
  • The <h:messages> tag is practically worthless. Sure it's great for displaying messages (error and success), but that's about it. It has a "layout" attribute that doesn't even work in Sun's RI, and in MyFaces it just wraps a <span> with a <ul><li> or a <table>. Both of these layouts are useless b/c you can't set a css class on them. I ended up using "table" and having to set a generic CSS rule (width: 100%) in order to get the message/error bar to show across the top of my page. This tag also doesn't allow you to escape HTML.
  • The <h:dataTable> component is nothing like the displaytag. MyFaces claims to have a pageable/sortable component, but it requires custom logic/methods in your managed-bean. Yuck. I ended up using <h:dataTable>, which has neither sorting or paging. This is only because I couldn't get an <h:commandLink> working inside a displaytag column.
  • JSF-created apps are pretty much untestable. Managed-beans are testable, but the UI seems really difficult with jWebUnit and Canoo's WebTest. IMO, it should be possible to specify a URL to edit a record (i.e. editUser.html?id=2). With JSF and my master/detail app, the link to edit actually sets about 5 hidden form fields with JavaScript and then submits the form. I could probably figure the URL out, but it'd be ugly. Also, the MyFaces <h:dataTable> will not render an "id" attribute if you specify one. This is needed to verify tables and their data with jWebUnit.
  • When using "ant reload" to reload my application (using Tomcat's Ant Tasks), I kept encountering a ThreadDeath error. This seems to be specific to MyFaces as I never saw it with other frameworks or Sun's RI.

Like Tapestry, I felt like I was banging my head against the wall a fair amount. However, with Tapestry (and all the other frameworks), I was able to get exactly the behavior I wanted w/o too much work. I could produce clean and user-friendly error messages - (Tapestry already had clean required messages built in). I was able to write a jUnitWebTest to test all CRUD activities. With JSF, I was able to test one thing - adding a new record. I couldn't edit it b/c the JavaScript support (which I tend to not use) puked every time it encountered a JSF-generated JavaScript function.

My opinion after all of this? If you know Struts, Spring MVC and WebWork are fairly easy to learn. WebWork is simpler and elegant, but Spring MVC supports more view options out-of-the-box. Tapestry is cool, but you'll have to invest a lot of time into learning it and you'll probably get caught up in its cult and forever be claiming "Tapestry Rocks!" which can get annoying to your fellow developers. ;-) Finally, I can confirm that SiteMesh rocks - it worked for all the frameworks I used and I never had to change a single line of code.

Whatever you do, don't use JSF. Not yet anyway.

Posted in Java at Aug 06 2004, 04:53:22 PM MDT 76 Comments

The Joy of developing with JSF

I plan to write up a "My JSF Experience" post later today, but first, I'm forced to rant on the state of JSF implementations. First of all, I must say that JSF isn't so bad. It's cool how you can map buttons to "actions" defined in a navigation entry, as well as to call a method in a managed bean. The problem that I'm experiencing is that the JSF implementations, both from Sun and MyFaces - are errrrr, not so good.

I actually managed to almost finish my simple JSF sample app in one day, but then decided to shoot off some questions to see if I could resolve some remaining issues. Then based on feedback I received, I decided to switch from Sun's RI to MyFaces - not only for the "sortable" grid (I still don't know if it exists), but also Spring supports it w/o using an add-on library.

Ever since I switched, things just haven't gone right. First of all, MyFaces, requires your implement a <listener> in web.xml - who knows why, but you get an error indicating you need it if you don't have it. Standard JSF doesn't require this - why does MyFaces?

OK, I can deal with adding the listener. Everything works as with Sun's RI - and even better since the "layout" attribute of <h:messages> actually works. BTW, why isn't "div" a choice instead of "table" - whoever designed these choices obviously still uses Netscape 4 and table-based layouts. I'm happy now. MyFaces seems to solve the duplicate post issue so if you refresh after adding a record, it just shows a blank form. Cool, I can live with that.

One problem I found, that likely exists in both implementations, is that it's a true pain-in-the-ass to get a declared ResourceBundle in a managed-bean. Here's the method I'm currently using to add a success message:

    public void addMessage(String key, String arg) {
        ApplicationFactory factory = (ApplicationFactory)
            FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
        String bundleName = factory.getApplication().getMessageBundle();
        ResourceBundle messages = ResourceBundle.getBundle(bundleName);
        MessageFormat form = new MessageFormat(messages.getString(key));

        String msg = form.format(new Object[]{arg});
        FacesContext.getCurrentInstance().addMessage(null, 
                new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg));
    }

There has to be an easier way! Please tell me there is. I admit that I'm a JSF rookie - having just started using it two days ago, but it seems ridiculous that all the "success message" examples out there don't even consider i18n.

So now I have my success messages working, but I discover that there's no way to escape HTML (using <h:messages>) from my ResourceBundle (to put bold around a part of the message). ALL of the other MVC frameworks I've been dealing with allow this - why doesn't JSF?! Again, I'm hoping someone tells me I'm ignorant and there is a way to do this.

Lastly, I tried to upgrade to the latest MyFaces snapshot from CVS to solve this bug and now I can't even get my fricken app to start up because of this issue. Are these the hoops that developers have to go through to get started with JSF? Thump, thump, thump. My head is starting to hurt.

Update: I'm an idiot about the "can't get my app to start thing" - I didn't copy all the new myfaces*.jar files into WEB-INF/lib. Heh. =P~

BTW, MyFaces requires a whole slew of JAR files just like Struts. Here's my current inventory:

  commons-codec-1.2.jar
  commons-collections-3.0.jar
  commons-digester-1.5.jar
  commons-validator.jar
  commons-oro.jar
  commons-logging.jar
  jstl.jar
  myfaces.jar
  myfaces-components.jar
  myfaces-jsf-api.jar

Posted in Java at Aug 06 2004, 10:35:05 AM MDT 4 Comments

Eclipse Plugins Updated for 3.0

I finally got around to updating my Eclipse Plugins package for Eclipse 3.0 → Download or read the Release Notes. Below is a list of plugins included in this download. I dropped Lomboz and JSEditor b/c they didn't work at all with 3.0 on Windows - which I expect is the largest user base. Additions include CSS Editor and Doclipse.

Colorer and Jalopy don't work on OS X, so I wouldn't even bother installing them. Colorer has issues on Linux too. For OS X, I'd recommend buying a subscription to My Eclipse. It's only $30 and if you can afford a Mac, what's another $30? ;-) For a source code formatter on OS X, I recommend buying IDEA - it's only $200 - same cost principle applies. I tend to use IDEA a lot more on the Mac simply b/c it's faster and you don't need to install all these plugins. However, I've been stuck a lot in Eclipse-land lately because of it's multiple-project-in-one-pane support - as well as it copies and pastes code nicely into Word.

In addition to these plugins, I recommend installing the Spring IDE Plugin if you're using Spring [HowTo] - and Spindle if you're using Tapestry. Hopefully, distributions like this will become unnecessary with the introduction of the Web Tools project.

Posted in Java at Jul 23 2004, 03:31:57 PM MDT 13 Comments

Colorado JUGs

The last two nights I gave talks at the Denver JUG and Boulder JUG meetings. On Wednesday night, I presented AppFuse in the basic concepts meeting and Thursday I was the main speaker at BJUG. Both meetings were great and my presentations went pretty well. Denver had about 50 attendees and Sue Spielman gave a very informative talk on J2ME. To me, J2ME seems like the equivalent of Swing for the Desktop. Building mobile-friendly websites seems like an easier route - then you don't have to worry about how the phones differ. Maybe I don't know enough about J2ME - why should I write a J2ME app when I can write a webapp? To me, it seems that I should stick with what I'm familiar with - and if I do choose to get into the mobile space, websites would be the way to go. My phone (a T68i) was very helpful last week in San Deigo. I used it's internet access and go2.com to find directions to several locations in San Diego. I just told the website to "auto-locate" me, then I'd type in an address and voila - it spit out a list of directions. Bruce and James also wrote about the Denver meeting.

Last night was the Boulder meeting, where Scott Davis kicked it off with a talk on Struts. My AppFuse presentation could've been much better if I based mine off of Scott's. I do some live coding of a DAOTest and a DAO in my presentation - and I think the audience would've gotten a lot more out of it if I'd showed them how to develop Actions and JSPs with AppFuse. Oh well, that's what the tutorials are for. I also like showing the DAO stuff because it shows the power and simplicity of the Hibernate+XDoclet+Spring combination. It's pretty cool to mention that integrating Spring into AppFuse only took a few hours. During integration, I remember deleting 5 or 6 classes/files and reducing my LOC count by about 75%.

After the meeting, I talked to one guy who was interested in adding a Swing front-end to AppFuse. I told him it shouldn't be too hard since the dao and service layers are already packaged as JARs. From a Swing app, you could easily reuse the business delegates and DAOs to talk to a database. The hard part would probably be mimicing authentication and authorization. I'm guessing that JAAS could probably provide a nice standards-compliant solution for this. I'm sure Spring's RCP project could make developing this front-end even simpler. I also talked to Kris about helping with the WebWork version of AppFuse. Hopefully he can help me out and make that happen sooner than later. I'm still targeting the end of July for a WebWork/Sitemesh-enabled release, as well as lots of enhancements to IDE friendliness.

Both meetings where followed by beers and good conversation. Last night, the tavern we were at lost power after about an hour. That didn't stop us from spending another hour in the dark telling old war stories. Good times - thanks to all who participated!

Posted in Java at Jun 11 2004, 10:00:24 AM MDT 7 Comments

How do you make your source tree Eclipse/JUnit friendly?

I've never had a problem getting builds and unit tests to work with Ant. However, unit tests run faster in an IDE, so I'm trying to refactor some code to allow for testing in the IDE. My current directory structure looks like this:

-- project
   - web
     - WEB-INF
       - classes

I need both "WEB-INF" and "WEB-INF/classes" in my classpath. There's XML files under WEB-INF for Spring and Commons Validator, and there's a log4j.xml under WEB-INF/classes for log4j. These files are all in their natural locations as far as all the projects I've seen. However, Eclipse won't allow me to nest classpaths - so it's virtually impossible (as far as I know) to add both directories to my classpath. Any ideas how to workaround this Eclipse "feature" are appreciated.

For those "IDEA is better" folks - I agree. IDEA allows me to add web, web/WEB-INF and web/WEB-INF/classes to my classpath with no issues.

Posted in Java at Jun 02 2004, 12:46:10 AM MDT 6 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

My Review of Java Studio Creator (a.k.a. Rave)

I attended a Rave Demo at Sun in Broomfield today. The meeting actually had two parts - the first hour was a marketing schpeel about Sun's Enterprise Java System and the second hour was a demo of Java Studio Creator. The first hour was boring and very marketing esque - they did have an interesting price point though - $100 per employee. This is small business friendly, which is nice to see.

The Rave (a.k.a. Java Studio Creator) Demo was when things got good. Here's my notes from Dan Robert's presentation, followed by my impressions and comments. Dan is the Product Manager for JSC and was seemed to be very in tune with the tools marketing (i.e. all the good stuff from Intellij and Eclipse - and how JBuilder sucks).

What is it?

  • New Java Development Tools initiative
    • For the corporate developers who write code, but don't understand all of the complexity of J2EE and just need to get their job done.
  • A full fledged Java IDE
    • Visual Design Tools, 2-way editing, Editor, Debugger, Repository Management, and Project Management
    • Cool new Look and Feel
  • Complementary to NetBeans and Java Studio
    • Even Enterprise developers can use it for Rapid Prototyping
    • Use Java Studio or any other tool to add persistence layers (heh, this is b/c they think that persistence can only be EJBs ;-))

What does it do?

  • Quickly builds web applications that solve time-critical, real world problems
    • Complete web application creation for departments, workgroups and businesses of all sizes
    • Focus on easy to understand, event driven coding model
    • Simplifies access to existing infrastructure
    • All Java-standards based servers, all databases, all Web services, all desktops
    • Their main goal is to do web applications well, they'll catch up with the rest later

Standards-based solution for all developers

  • A development solution based on 100% Java standards
  • Delivers "Write Once, Run Anywhere"TM benefits: portable apps, portable developer skillsets
  • Quickly solves time-critical app development needs
    • Drag and Drop, rapid visual access to databasess and web services
    • consistent UI look/feel/behavior across all apps

Visual features to speed development

  • Palette for widgets, custom graphics, code clips, etc...
  • Query Editor

Simplified Access to Existing infrastructure

  • Use any JDBC Compliant Database (3.0)
    • Drag in and automatically create DB connections to data-aware components
  • Web Service Consumption
    • Easily pull in existing web services from Enterprise wide solutions or business partners

Java Studio Creator Roadmap

  • Hammerhead:
    • 2-tier dynamic content web applications based on JSP and JSF with Page Flow design tools
    • Releases: Early Access Spring 04 (today!), FCS Summer 04 (at JavaOne)
  • Thresher:
    • Minor Update Release
    • Focuses on Ease of Development and Stability
  • Mako
    • Extended Client Support

Download today from http://www.sun.com/jscreator. OS X version will be available shortly after the release (JavaOne).

After the PowerPoint, Dan started into the Demo. The first thing I saw that was cool was that when he clicked on the "Run" button, it actually deploys the app and opens the browser to run it. What you see in the browser looks very similar to what you see in the IDE. The IDE looks very simple. My current client went with me and he remarked that it "looks a lot like Eclipse."

The IDE has lots of palettes, and the UI essentially looks very clean. The pallets can be docked just like in IDEA - which I like. It looks a lot more like a native Windows application than it does like Swing. Here are the palettes it has:

  • Server Navigator
    • Data Sources
    • Web Services
    • Deployment Servers Palette
  • User Defined
    • JSF Standard Components
    • JSF Validators / Converters
  • Property Sheet
  • Project Navigator

Dan then dragged a drop down component and a table component onto the page. Secondly, he added a stylesheet and it visually changed the background and fonts on the page. I asked him if there was an imbedded browser. He said they took a look at using Mozilla, but it was too much and apparently one of the "real smart" engineers wrote the embedded browser component from scratch. Dan said it was the same guy who wrote the demo from scratch in 2 minutes at JavaOne last year. The thing I found very cool was that the HTML that is written into the JSP is XHTML - none of this Netscape 4.x support. Fuck Netscape 4.x - I'm glad Sun had the foresight to drop support for it.

After adding the stylesheet, Dan used the Data Sources navigator to grab a table and drag it to the drop-down. Then he did the same for another table and the data grid. Using the Visual SQL Query Builder (which looks a lot like M$ Access) he linked two tables and added a new column from a 2nd table to the grid. He then showed us that JSC has pretty good support for 2-way editing. Edit the code, the visual representation changes. Edit the visual, the code changes. This seems to be a big problem with WYSIWIG editors, especially when it comes to dynamic webapps. It appears that they've done a pretty good job to solve this.

Next he showed us some cool features of the components. For the table, there is an "enable paging" checkbox - and for the drop-down, you can right-click and select "auto-submit on change." He then set a couple of converter types on the drop-down and had to hand-code the event handler for the drop-down. Two lines of very simple code and he was done. The code was simple enough that you could have guessed the syntax. Code completion popped up nicely as well. Apparently the JSF coding style is that each page (JSP) is backed by a Bean that contains different event handlers. The code looked pretty simple and all the data was retrieved via RowSets.

Bill Dudney was there and asked about testing tools (i.e. Cactus or JUnit). Dan's response was that these are usually used by more advanced Java developers and there's talk of it, but nothing has been done yet. Now he pulls up a very cool page navigation creator which he uses to drag and drop buttons and links to point to different pages. Then someone asked about cost - and here's what makes it great. Under $300. They also hope to have lots of add on components for JSF by JavaOne. Unfortunately, there's no tooling for building JSF components in Java Studio Creator. For more information checkout http://developers.sun.com/jscreator.

The main reason I really like Java Studio Creator was that you literally never had to see any JSF code - and you get all of the features I like to use in webapps. Furthermore, I've been training a couple of guys all week on JSPs and using JSTL's SQL tags to do CRUD on a database table. While it's simple stuff, since they've never done web development before, it's a bit advanced. I'm sure their eyes will glaze over tomorrow when I start showing them how to write JUnit Tests, DAOs and how to use Hibernate to CRUD an object. They'll probably fall asleep by the time I show them how to wire the DAOs to Hibernate using Spring. When they saw this demo today - there eyes lit up and they got inspired to do their projects again. It looks easy for them now. All they need is a JDBC 3.0 driver for DB2 and they should be able to rapidly develop webapps with Java Studio Creator. I don't blame them for wanting to use this tool - it greatly simplifies things.

After the meeting, I asked Dan about transactions and if it was possible to use Hibernate instead of the RowSet stuff. He said that since JSC is based on NetBeans, you could probably write a plugin to use Hibernate instead of RowSets. As far as I know, the main reason you'd use Hibernate is for caching - but rowsets probably have that too. I know that the spec lead for JSF is talking to the Spring developers about JSF-Spring integration, so maybe that will be a future option as well.

Another thing that's not currently supported is the use of great technologies like Tiles or Sitemesh. Sitemesh integration would likely be pretty easy - you'd just never see your decorated UI in the IDE. Tiles is definitely something on the roadmap, but they don't have a solution yet. Dan indicated that using "includes" in your JSPs should work just fine - rendering in the IDE as they would in your browser. Good stuff - I hope we start using it at my current project - I think it'll do wonders for productivity. Since it's based on standards (JSF and RowSets) - the generated code looked pretty clean too.

Posted in Java at Apr 08 2004, 10:12:34 PM MDT 20 Comments

Eclipse Plugins updated for 3.0 M8

At my current client, I'm teaching a class this week on developing Java-based webapps. I'm starting simple with basic JSPs and JSTL's SQL Tags. Later, I plan to teach them how to write JUnit tests, DAOs, Actions, etc. I hope to show them how Hibernate and Spring can reduce the pain of J2EE.

The main problem is that it's kinda tough to teach this stuff to people that have no webapp development experience. How can you tell them Hibernate is soooo much easier, when they've never used JDBC? How can you show them that Spring simplifies things when they've never developed a complicated app?

Anywho, back to the point of this post. As part of the first day, I had the class (actually, there's only 2 students) setup their development environments (JDK, Eclipse and Tomcat). I decided to go with the latest Eclipse 3.0 M8 b/c I'm an upgrade junkie and I firmly believe that it's best to teach the latest and greatest stuff. Because we're using M8, I had to update a bunch of plugins and decided to package it up and release it. So without further ado, I give you Eclipse Plugins 1.1. [Download, Release Notes]

Here's the current list of plugins included in this package:

NOTE: I updated most of these plugins because older ones didn't work with Eclipse 3.0 M8. I haven't tested all of these, but they are the latest versions (as of yesterday).

I still use Eclipse on Windows, but I sure am getting used to using IDEA on the Mac. Now if I could only figure out some slick ways to pre-program keys-to-code. The Flex guy in NYC last weekend would press one key and a whole block of text would appear. I think that'd be a nice touch for next week's presos in Florida. It'd be cool to write a JUnit Test, DAO Interface, and DAO Implementation in a matter or keystrokes (i.e. one for each method).

Related posts: 1.0 Release.

Posted in Java at Apr 08 2004, 12:37:23 AM MDT 17 Comments

Saturday Afternoon

I have a whole bunch of notes from watching all the speakers this morning, but there's no point in me regurgitating all the stuff that Jason has written. Unfortunately, I don't have unlimited bandwidth on my phone - so this post (and checking my e-mail) will probably cost me $20. I finished my talk about a half hour ago and damn it feels good. All my worrying from the last week is over. I'm done. Phewfta. ;-)

Below are my thoughts on the speakers so far. I'll update this for Vic (speaking now) and Jason as they speak.

Clinton Begin: - iBATIS. He actually works for ThoughtWorks in Calgary, which I didn't know. I've met Ted, Jason, Rod and Tom this morning. All very cool guys. It's funny to see Jason and Ted sitting at the same table - I thought they were mortal enemies. ;-) There's not a whole lotta folks here - approx. 30 right now. That's good since this room doesn't look like it'd hold much more than that.

Clinton wrote SQL Maps because Data Models are rarely perfect. He's actually using Hibernate right now - b/c his team has control of the database.

Clinton is toying with the idea of using something like XDoclet to generate SQL Maps.

Caching - on a single box OSCache is the slowest caching mechanism. It'll actually cost you more than it helps you. For distributed systems, however, it's the only choice. He doesn't know why it's so slow - it just is.

Rod Johnson - J2EE without EJB. Rod actually flew in from London just for this event. It's his first time to NY, as it seems to be for many speakers here. I took a lot of notes from Rod's presentation. He was mainly advocating that you can write fast, scalable J2EE apps without EJB. He didn't cover Spring much, but did point out that Spring offers most of EJBs built-in services. After watching Rod's presentation, the only reason I can see for EJBs is for distributed systems. However, these days it seems that more folks are using web services instead of RMI.

Ted Husted - Commons Chain. Ted's presentation was quick (1/2 hour) and I missed most of it, so I can't really comment on it.

Vic Cekvenich - basicPortal RIA. Vic's presentation was titled "basicPortal RIA" but that's not what he covered. He ended up talking about requirements, project management and good programmers. Damn, I've heard this talk before - nothing new here. It's good stuff though, and an enjoyable talk.

Vic's predication: in the next 12 months, declarative languages (like Flex, XAML and XUL) will be next generation of MVC frameworks. He thinks it's very liberating to not write HTML anymore. As I said yesterday - you're still writing XML, so as a developer I don't think you have to learn that much. He just showed us some Flex code - it's pretty simple stuff. 10 lines of code to declare a data grid (like the display tag) and load its data from a DAO.

I asked Vic if calling a DAO from the View (Flex page) is a bad thing. Isn't that like using scriptlets in your JSPs to call your DAO? I mentioned that the design pattern bigots would bash all over this. He said - "screw the design patterns, this works." I suspect the next guy (Christophe Coenraets on Flex) might promote cleaner design patterns. This should be fun - a bunch of open source fans about to be presented with a closed-source, expensive product.

Posted in Java at Apr 03 2004, 01:37:16 PM MST 1 Comment

SiteMesh passed the 10 minute test

I decided to go out on a limb this evening and give SiteMesh a run for its money. The first warning sign was that the documentation refers to version 2.0.2, while the downloads section refers to version 2.0.1. So I proceeded to download 2.0.1. I promptly noticed that the install guide indicated I needed to download SiteMesh's two TLDs and configure them in my web.xml. Blech - this is so year 2000 - most modern containers support loading taglibs from JAR files with a URI.

So I did a good ol' cvs co of sitemesh from java.net. First of all, I'd like to say kudos to java.net and their CVS repositories - they've been rock solid for the few weeks I've used them. After checking out sitemesh, the first thing on my agenda was to give it the tried n' true ant test. This means I navigate to the sitemesh folder and simply type "ant". At this point, I should get one of two things - a BUILD SUCCESSFUL with a JAR or a help message telling me what I should type. I got the former, which I prefer.

After this, I integrated it into my app using the decorators documentation and deployed it. At first, I received the lovely ol' "getOutputStream() has already been called for this response" error, so I hacked PageFilter.java to use PrintWriter writer = response.getWriter(); instead of PrintWriter writer = new PrintWriter(response.getOutputStream());. Build, copy, package, deploy and voila - it all worked!! Wow that was easy. ;-)

Here's the weird part. I decided to reverse my hack on PageFilter.java to prove that I'd actually fixed the bug. Now I'm back to the original code I got from CVS and I can't get the getOuputStream() error to rear its ugly head. Doh!! This experience begs the following question.

Is SiteMesh stable enough on Tomcat 5 that I can should use it in my Spring Live sample app?

SiteMesh definitely passed my 10 minute test, we'll see if it holds up for the long haul. So far, I'm quite impressed with its easy configuration and quick implementation. I especially like that you can literally guess at it's syntax and you'll get it right. Maybe I was just lucky... heh

P.S. You should probably know I'm a big fan of Tiles. I wonder if SiteMesh will let me switch a decorator on the fly like Tiles does?

Posted in Java at Mar 24 2004, 12:07:56 AM MST 16 Comments