20040502 Sunday May 02, 2004

Converting AppFuse to use Spring for MVC It's been a long and painful week - with 3 or 4 nights where I was up to 4 or 5 in the morning. Last night I was up until 4:30 and Abbie woke me up promptly at 7:30. Ugh, sleeping more is probably a good idea. I started on the Spring MVC layer for AppFuse on Thursday night and it took me almost 2 days to convert everything. There's still a few kinks and workarounds - but if you're running it through a browser, everything works the same as it did with the Struts version. The hardest part about it was writing the unit tests. With Struts, it's rather easy b/c I use StrutsTestCase, which provides a very simple API for testing Actions. I'm sure Spring will soon have this same capability with its Servlet API Mocks, but I was definitely banging my head against the wall a few times. I did manage to convert the LabelTag to recognize required fields and error messages. The JSP conversion was a slight pain - but mostly because you have to type a lot more for input fields than you do for Struts. I'm looking forward to WebWork which requires one line to do the whole table row. It has Velocity templates for its tags and they write the <tr>, <label> and the <input>. Pretty slick IMO - less typing is always attractive to me.

I'd like to write-up a detailed entry on "migrating from Struts to Spring" on JRoller, but it's been flakey over there for a few days now - so I might just do it here. We'll see - the lack of sleep is draining my motivation to write. I hope to do the Ant-based installation for Spring in the next couple of days - then I'll release 1.5 beta. My main reason for the beta is because the Spring stuff can probably be cleaned up a lot, as well as it gives me time to write documentation before the final release. Posted in Java at May 02 2004, 09:17:54 AM MDT 5 Comments

Comments:

You are a machine! Wish i could handle that type of punishment and still remain focuesed on the keyboard/monitor... Matt, I have to ask, what is your secret?

Posted by bren on May 02, 2004 at 04:56 PM MDT #

It depends on what I'm working on. If it's something that really excites me, like Spring and XDoclet - it's actually pretty easy to stay up. Especially when things start clicking. For those times when I'm banging my head against the wall, I resort to a little Red Bull to keep me motivated. ;-)

Posted by Matt Raible on May 02, 2004 at 08:45 PM MDT #

Great work! I can't wait to port our Struts app to Spring. Our backend Actions, DAO, etc are all Springified right now. It's the JSP porting that scares me. There's a big difference there. We started making tagfiles that mirror the functionality of the Struts radio, checkbox, and select tags. Those are nice time (and code) savers and luckily tagfiles from JSP 2.0 makes it easy (finally!!). I'd be very interesting in any lessons you've learned from this porting excercise. Now that Spring has 1.5 validation choices (commons-validator and the (coming soon) attributes validation) it seems that Spring just needs the HTML utility tags from Struts.

Posted by Seth Ladd on May 03, 2004 at 12:40 PM MDT #

Looking for a 'Migrating Struts MVC to Spring MVC'. Can you point me? akilas#fusionmax.com

Posted by 209.87.176.3 on June 09, 2004 at 12:46 PM MDT #

Akilas, check out Matt's entry at JRoller.

Posted by Pål Brattberg on July 13, 2004 at 12:37 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architecture Consultant specializing in open source frameworks.
« May 2012
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
23
24
25
26
27
28
29
30
31
  
       
Today

Recent Entries

Tag Cloud