Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming Books Media Book Reviews IT Technology

Manning's Struts in Action 163

cpfeifer writes "Building browser-based java applications has involved a mixed bag of server side technologies (servlets, JSPs), client side technologies (HTML, Javascript) and frameworks (webmacro, Struts, Taglibs, Velocity). As these technologies appeared and matured, "The Right Way" (tm) to build web applications evolved to be an application of the classic model-view-controller pattern." Below is Craig's review of Struts in Action, a book which attempts to illustrate a successful path to making sure that web applications are designed the right way.
Struts in Action
author Husted, Dumoulin, Franciscus, Winterfeldt
pages 630
publisher Manning
rating (11/10) it goes to 11
reviewer Craig Pfeifer
ISBN 1930110502
summary More than just a book about how to use the Struts framework, covers the best practices of web application design and development. If you are building a java web application of any appreciable size, YOU NEED THIS BOOK.

What's Needed

So it is generally acknowledged that using the MVC pattern is the proper way to build web applications, but with the large number of technologies and frameworks it can be a long road to figure what is the best solution for your application. What we need is a book that covers the best practices of web application design and development from both a technology/architecture perspective, and is written by a few folks who have deep understanding of the underlying problems of building robust web applications.

That's what I love the most about this book, it doesn't just talk about how to configure and develop with Struts. It's a web application manifesto. Anyone can write a book about how to use Struts to build a web application. That's not the point. This book is ~8 people-years worth of first-hend developer knowledge (4 authors x ~2 years of working on the Struts project) condensed down into 630 pages. It doesn't just teach you how to use Struts (and Velocity and Taglibs and Tiles), but why you should use them. That's the most important thing this book has to offer. If your project is looking at using Struts & other Jakarta technologies, you need this book. If your project is currently using Struts & other Jakarta technologies, you need this book.

What's Bad?

The Velocity coverage is pretty light. If you are more comfortable building logic with a quasi-shell script language instead of using markup tags, then you should look to the project's documentation for further reference before embarking on a prototype. The Jakarta Lucene project, is touched on in the sample application they build, but are left as an exercise for the reader to investigate. While it's good to bring in related technologies to flesh out your sample apps, you have to be careful not to get sidetracked from the primary topic. You could easily write several books about the other components developed by the Jakarta project.

What's Good?

The best part is that the 4 authors are all Struts authorities (one Jakarta project manager, 2 Struts committers, one principal consultant), so they know Struts and the other Jakarta web frameworks inside and out. More than that, these guys have been solving the problems involved with web applications for several years now. They have deep experience in the patterns and best practices of building robust and flexible web applications, and this book passes on their experiences to the reader.

So What's In It For Me?

With this book and a little bit of effort on your part, you will be a competent Java web application developer. With a little bit more effort, you will become a Java web application architect. It's worth the extra effort. This is a tremendous book that will set the standard for web application references and will continue to be useful for years to come. It reminds me of the first Manning book I read, Neward's Server-Based Java Programming in terms of it's scope. approach and usefulness.


You can purchase Struts in Action from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

Manning's Struts in Action

Comments Filter:
  • by cjustus ( 601772 ) on Tuesday December 03, 2002 @11:51AM (#4801750) Homepage
    Am I one of the first to follow up? Sweet

    People considering using structs might want to take a look (as you always should) at alternate technologies... The one I might suggest would be Tapestry [sourceforge.net] with IDE integration with Eclipse through Spindle [sourceforge.net].

  • by Anonymous Coward on Tuesday December 03, 2002 @11:53AM (#4801778)

    www.cgisecurity.com/lib [cgisecurity.com]
  • by Cap'n Canuck ( 622106 ) on Tuesday December 03, 2002 @12:03PM (#4801855)
    There's a site called JavaRanch [javaranch.com], which has some useful forums for the serious Java developer. If you participate in their "Open Source Projects" forum, you'll be entered into a draw to win a copy of the book.

    Also, one of the authours (Ted Husted) will be on-line to answer questions. Note that you need to register - No Anonymous Cowards!
  • Manning Press (Score:4, Informative)

    by Frums ( 112820 ) on Tuesday December 03, 2002 @12:06PM (#4801891) Homepage Journal

    I have this book, and JSTL In Action and both of them are truly excellent books. The 11/10 rating is quite appropriate. I have been attempting to convince myself to buy the Manning Ant book as well - just for the documentation on all of the Ant extensions that it includes.

    Additinally, Manning Press has experimented with releasing PDF versions of books (in read only if you use acroread or windows, but not otherwise) and this was how I first met their books. (The books were hosted over at The Server Side [theserverside.com]). Anyway, this was my first intro to Manning Press. I now look over their books before any other.

    The think I like most about Manning books is that they are written for smart people who have clues. Many tech books feel the need to explain basic concepts of programming in every single one, Manning doesn't bother - they stick to the topic on hand, they write as if the audience has a clue, is intelligent, and has real work to get done.

  • Struts and O'Reilly (Score:4, Informative)

    by pcraven ( 191172 ) <paul AT cravenfamily DOT com> on Tuesday December 03, 2002 @12:16PM (#4801969) Homepage
    I really like the O'Reilly book that just came out. Most of the chapters of this book went through public review, if I remember correctly. The book is very solid.

    The real advantage of struts for me comes from its ability to handle forms. Regular expression checking of input is a great way to make sure you don't take in bad data. Not having to write this code, and code to handle and repost the page when errors occur, takes away a lot of the tedium of development.

    What I don't like about struts is all the abstractions. New developers should start with the basics and work up. But no one has the time for that. So figuring out what is going on under the covers is hard to do. The O'Reilly book is pretty good at trying to explain some of this stuff. But there's no substitute for actually doing it.

    And is it just me, or has 'real' coding started to go away? I spend half my time messing with xml config files anymore. I get more done, but it isn't as much fun.
  • Re:What is Struts? (Score:2, Informative)

    by FortKnox ( 169099 ) on Tuesday December 03, 2002 @12:19PM (#4801994) Homepage Journal
    Struts [apache.org] is an online J2EE framework that utilizes the Model View Controller pattern. Look on the website for a good overview.
  • by thelexx ( 237096 ) on Tuesday December 03, 2002 @12:35PM (#4802132)
    WTFever people. From the Velocity (which I prefer to Struts) site:

    Velocity is a Java-based template engine. It permits anyone to use the simple yet powerful template language to reference objects defined in Java code.

    When Velocity is used for web development, Web designers can work in parallel with Java programmers to develop web sites according to the Model-View-Controller (MVC) model, meaning that web page designers can focus solely on creating a site that looks good, and programmers can focus solely on writing top-notch code. Velocity separates Java code from the web pages, making the web site more maintainable over the long run and providing a viable alternative to Java Server Pages (JSPs) or PHP.

    Velocity's capabilities reach well beyond the realm of web sites; for example, it can generate SQL and PostScript and XML (see Anakia for more information on XML transformations) from templates. It can be used either as a standalone utility for generating source code and reports, or as an integrated component of other systems. Velocity also provides template services for the Turbine web application framework. Velocity+Turbine provides a template service that allows web applications to be developed according to a true MVC model.

    ---------------------

    Velocity is dead simple to use, as it is not some kind of entire 'framework' that wants to manage your DB connections, life, etc. It makes using JSP look like masochism. If you really feel like recreating the wheel though, and are convinced that you know better, etc. then feel free to waste your time. I pity the fool who has to maintain your cruft though.

    (Would like to be posting more thoroughly on this, but it ain't happening this morning...)
  • by Mindbridge ( 70295 ) on Tuesday December 03, 2002 @12:40PM (#4802178) Homepage
    I have to disagree completely.

    If you come from a Swing background, Tapestry is way more intuitive than Struts. You have components in both, and building your gui involves putting components in components, and finally into a frame (Swing) or a page (Tapestry). You don't have to care about how the JTable (Swing) or Table (Tapestry) components are implemented, you just follow the API and use them. I really don't see the similarity between this and JSP or Struts.

    I think Tapestry is the only free Java framework out there that actually allows you to really build components rather than pages (as it is in most of the rest). You can build a component to edit the user preferences, for example, and it really does not matter which page or another component you put it in, how you put it in, and what the layout is. It IS Swing for the web.

    It also has a lot of other things that are worth using, but for those check the Tapestry home page [sf.net].

  • by Vaulter ( 15500 ) on Tuesday December 03, 2002 @12:44PM (#4802211)

    You obviously don't know what struts is.

    Struts is a set of server side components for implementing the MVC pattern, that come with some JSP tag libs as a convenience.

    Struts can be used with Velocity. Velocity can only replace JSP, not struts.

    FWIW, I love velocity as well. I use it in stand alone applications as well as web applications.

  • by Bazzargh ( 39195 ) on Tuesday December 03, 2002 @12:48PM (#4802246)
    You're right that simple MVC webapps are easy, but the easiest approach is actually the one described in this article by Govind Seshadri [javaworld.com].

    What your approach misses that you get from Struts:
    - validation of form submissions (to java types, regexps, whatever)
    - automatic population of form beans, which leads to...
    - automagic prepopulation of forms from beans used earlier in the session (with struts custom tags)
    - tool support for designing complex sites (there are lots of GUIs for struts these days)
    - you don't need to write or maintain any of the framework :)

    Every framework brings with it some constraints in how you work, but pays off in spades if you use all the features. Struts is no exception. If all you're doing is the stuff you describe, Govind's article might improve your life a little. If you build complex sites, Struts will simplify your life a lot.

    Just a quick concrete example: in struts, the equivalent of the IndexServlet you describe is the DispatchAction. You'd configure like so:

    Then you can write:
    package funky;
    class IndexAction extends org.apache.struts.actions.DispatchAction {
    public ActionForward login(...);
    public ActionForward mainmenu(...);
    public ActionForward saveform(...);
    public ActionForward etc(...);
    } ...and the methods are automatically called depending on the value of 'f'. Like you said, "Of course some actions can be used for more than one thing if you code smartly.", and in this case the smartly was done for you ;)

    -Baz
  • by Bazzargh ( 39195 ) on Tuesday December 03, 2002 @12:50PM (#4802285)
    Sorry the config bit got chopped out - I wroute:

    <action path="/indexAction" type="funky.IndexAction" name="indexForm" scope="request" input="/index.jsp" parameter="f">
  • Some relevant links (Score:3, Informative)

    by Paul Bain ( 9907 ) <paulbain AT pobox DOT com> on Tuesday December 03, 2002 @12:54PM (#4802313)
    Struts is but one presentation framework. A discussion comparing Struts and other frameworks [enhydra.org] is informative, and, indeed, there is an entire website [waferproject.org] devoted to such a comparison. For Struts links, try the home page of Ted Husted [husted.com], the lead Struts developer.
  • CGI::Application (Score:2, Informative)

    by chad_r ( 79875 ) on Tuesday December 03, 2002 @01:42PM (#4802819)
    Perl coders may also be interested in CGI::Application [cpan.org], for a similar MVC approach. I've done a few JSP apps which had a framework similar to Struts (too bad I didn't know about it beforehand), and now I hate to write perl CGI's in the unplanned, ad hoc way I used to do.
  • by kwerle ( 39371 ) <kurt@CircleW.org> on Tuesday December 03, 2002 @02:38PM (#4803392) Homepage Journal
    We did a little comparison where I work (I'm a WODeveloper). The upshot is that struts looks like the best non-WO tech I've seen. There are a lot of similarities, as I recall, though the discussion was about half a year ago - about twice my memories half-life :-)
  • by Anonymous Coward on Tuesday December 03, 2002 @04:55PM (#4804666)
    Don't now if they mention this topic or not in this book -
    If you are currently using Struts 1.1, you should consider the upcoming changes to it vis-a-vis Sun's JavaServer Faces specification [sun.com].

    A recent and good introductory article about JSF is A First Look at JavaServer Faces [javaworld.com]

    Craig McClanahan mentioned the transition to using JSP Faces in one of his Struts presentations [apache.org] at the recent ApacheCon and it has been discussed on the Struts mailing lists (e.g. http://www.mail-archive.com/struts-dev@jakarta.apa che.org/msg08457.html [mail-archive.com]

The Macintosh is Xerox technology at its best.

Working...