Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Java Books Media Programming Book Reviews

Struts Kick Start 134

Simon P. Chappell writes "I started learning how to use the Struts framework in late in 2001, after I became fed-up with hacking web applications together with the digital equivalent of "Duct-tape Engineering". At that time there were no books available for the budding Struts developer, "Read The Fine Manual" was not an option ... you read the website, you read the code or you asked questions on the mailing list. This situation finally changed this fall with the release of a flurry of titles dedicated to Struts. I present here my thoughts on one of the latest: "Struts Kick Start". The rest of Simon's review follows.
Struts Kick Start
author James Turner and Kevin Bedell
pages 481 (29 page index)
publisher Sams
rating 9
reviewer Simon P. Chappell
ISBN 0672324725
summary You need this book

What is Struts?

Struts is a framework for developing web applications. It is a distilation of the current set of known best practices into a working code set that can be extended to meet almost any web application requirements. It part of the Jakarta Project at the Apache Software Foundation.

What do I know about Struts?

I have been developing web applications, using Java, for four years and using struts for over a year, and am a regular participant on the Struts mailing list. I was also a technical reviewer for one of the other Struts Books released this fall and was recently invited to speak at the University of Wisconsin, Eau Claire on the use of Struts.

What's good about this book?

There are many excellent things that I could point to. I particularly like the obvious depth of research that accompanies this book. There is a very interesting history of the development of the MVC design pattern and they even name the inventor. Do you know who invented MVC? If you want to know, buy the book! The chapters cover everything that you will need to know, in the order you are most likely to need to know it. There's even a chapter explaining the "struts-config.xml" file's DTD! (You may want to skip that on the first few readings :-)

There is good coverage of the Struts taglibs. I see a lot of questions about these on the mailing lists, so this information is very timely and it looks very well explained.

I like the coverage of other open source tools that work well with Struts. This is an important point because Struts does not do everything for you (by design), so there will be areas that will benefit from other tools. I'm looking forward to trying out some of their recommendations and easing my own Struts development lifecycles.

What's not so good?

Just one niggle, and it's more of a programming style issue, but in their example code they have references to their business objects. They explain that it is important to separate out business logic from action logic, which it is, but then proceed to use their business object within the action.

Now, I realise that example code is not the same thing as robust, production-ready code, but when people are first learning a language or framework, they tend to copy exactly what they see in the book they are learning from. Even though example code should be light on error checking, it should be heavy on correctness and good style.

Should you rush out and buy it?

If you are about to use Struts on a project, are new to Struts and need dead tree documentation for those RTFM moments or are evaluating Struts for future projects, then you absolutely need this book.

If you are an intermediate Struts user, then this book would still be very useful to you and I can certainly recommend it.

If you are an experienced Struts user, then you've almost certainly exchanged emails with James or Kevin, on the Struts mailing list, so you can make your own mind up!

Table of Contents

  1. Struts in Context
  2. The Model-View-Controller Design Pattern
  3. Hello World!
  4. HTTP Protocol
  5. JSP, Taglibs and JSTL
  6. The Sample Application
  7. View Components
  8. The Controller
  9. Model Components
  10. The struts-config.xml File
  11. How the Struts Tag Libraries Work
  12. Struts HTML Tags
  13. Struts Bean Tags
  14. Struts Logic Tags
  15. The Nested and Template Struts Tag Libraries
  16. The Struts Tiles Tag Library
  17. DynaForms and the Validator
  18. Using Struts with Enterprise Java Beans
  19. Using Struts with Web Services
  20. Building, Deploying and Testing Struts Applications


You can purchase Struts Kick Start 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.

Struts Kick Start

Comments Filter:
  • Little nitpick (Score:4, Informative)

    by FortKnox ( 169099 ) on Tuesday December 31, 2002 @12:41PM (#4988731) Homepage Journal
    What is Struts?
    Struts is a framework for developing web applications. It is a distilation of the current set of known best practices into a working code set that can be extended to meet almost any web application requirements. It part of the Jakarta Project at the Apache Software Foundation.


    Struts is a Java/J2EE based framework. Although you could change it to use with other languages, it has taglibs and other features that are pretty much Java only.

    Why such an influx of Struts books? Its becoming quite the standard in the Java/JSP+servlet world. J2EE developers are still being hired (hear that unemployed CS people?), and have been strong through the IT drought, and Struts experience is an even bigger plus.
  • by General_Corto ( 152906 ) on Tuesday December 31, 2002 @12:45PM (#4988762)


    I've been working on a reasonably sized project for some time now (still undercover, so can't go into details)... I'd been looking for a good framework to use, and Struts looked like it fitted the bill.



    Until I started dealing with the display (view) side of things.


    Getting to grips with the Action and ActionForm stuff is simple, and I think that anyone could do it. However, because they expect you to use all the usual standard stuff (taglibs, etc), building new taglibs and dealing with that was going to be a nightmare.


    Also, the HTML taglib, when told to output XHTML only, doesn't work. tags like the BASE tag aren't closed properly.



    Fortunately, I'd been looking at using Tea earlier on (Jason Hunter uses it at servlets.com [servlets.com]). Someone on the tea mailing list posted a link to a very useful article on using Struts for the backend of a web app and Tea for the front end. You can find it here:



    http://www-106.ibm.com/developerworks/library/wa-t ea1/ [ibm.com]

    http://www-106.ibm.com/developerworks/library/wa-t ea2/ [ibm.com]


  • by revscat ( 35618 ) on Tuesday December 31, 2002 @12:49PM (#4988803) Journal

    Struts is an MVC-based framework for developing web apps. It helps to separate out the different layers of your application. You could use it with EJBs, if you wish, because it is mostly a means for separating out your business logic from your presentation.

    Asking "should I be using it?" is difficult to answer, because it depends upon your requirements. But if you are developing a web application that requires a quick turnaround time and is easy to maintain, Struts will help you along.

  • by MaxwellStreet ( 148915 ) on Tuesday December 31, 2002 @12:50PM (#4988809)
    Velocity is another jakarta project that helps out on the view side of things. You might want to check it out . . .
  • Not for a while (Score:3, Informative)

    by revscat ( 35618 ) on Tuesday December 31, 2002 @12:57PM (#4988867) Journal

    JSF could replace Struts one day, but not for a few years at the least. JSF is still in the early phases, whereas Struts has had several years to mature. I would definately keep an eye on JSF, but wouldn't recommend using it on non-experimental sites for a while.

  • Re:Little nitpick (Score:2, Informative)

    by bataras ( 169548 ) on Tuesday December 31, 2002 @01:10PM (#4988958)
    Struts is NOT J2EE based. it's plain vanilla JSP/Servlets based
  • Re:Little nitpick (Score:1, Informative)

    by Anonymous Coward on Tuesday December 31, 2002 @01:12PM (#4988982)
    JSP/Servlets are a part of J2EE.
    J2EE = JSP, Servlets, EJB (not just EJB).
  • Husted book (Score:1, Informative)

    by Anonymous Coward on Tuesday December 31, 2002 @01:41PM (#4989212)
    Actually, what I would like to see is a review of the Ted Husted book Struts in Action [manning.com] , ISBN 1930110502. It was listed as not published yet yesterday at amazon.com, but is now listed [amazon.com] as "usually ships in 13 to 14 days." It is available sooner at bn.com [barnesandnoble.com] or direct from the publisher. [manning.com] Husted is one of the more well-known Struts gurus, and I think his book has been much more anticipated than the one reviewed.

    One thing I like is that the publisher, Manning Publications [manning.com], lets you buy a PDF version of the book for half price. They will also deduct the cost of the PDF version if you decide to buy the tree version later. There are a couple of sample chapters [manning.com] online, one about integration with Tiles and another about validation. The sample chapters I have read seem very complete and well-written.

    I know this post sounds like an advert for the book, but I'm not associated with the book in any way. I'm just a Struts developer who's been waiting for a good Struts book to come along, and the Husted book looks like it might be the one.
  • by revscat ( 35618 ) on Tuesday December 31, 2002 @02:14PM (#4989442) Journal

    I thought we already had MVC with JSP/servlet/EJB. How does Struts change this? From what I can tell it's some sort of framework that handles form data validation. That's always rather tedious, so if Struts saves time it's a good deal.

    Mmmm.... Part of Struts is validation, although technically it is a separate component. (See the Jakarta Commons Validator [apache.org]) This is a minor (though extremely useful) part of it, however.

    What makes Struts what it is are (arguably) ActionForms (basically, JavaBeans with some enhanced functionality) and ActionForwards/ActionMappings. These allow you to separate out the logic which operates upon data which will eventually be diplayed from the actual display of that data. Because solutions which depend upon JSPs tend to become a mass of unreusable scriplets, having this separation allows for a more maintainable site and avoids the pitfalls which have traditionally plagued JSPs.

  • Re:Struts is GARBAGE (Score:4, Informative)

    by Lysol ( 11150 ) on Tuesday December 31, 2002 @03:55PM (#4990142)
    Not true at all. I've been following Struts for a *long* time and depending on the project it can make a huge difference. Sure, you can code page to page, embed the logic wherever and move on your merry way. But adverse things will definitely start to happen when:

    1. you are no longer 'the man' and the mgmt rolls in the html guy(s)/gal(s). most html people can deal with <xml style markup> than <%java scriptlet%> stlye <%blocks%> (i won't even get into logic flow in scriptlet blocks). separation of presentation logic from biz logic; speaks for itself. and it's possible with scripting languages, but tough.

    2. you want to extend the app. 'oh, but marketing want's to have their server also come in on that url that you did last year'. true, you could accomplish extension well with scripting language, but the delegation with struts/MVC us much cleaner and more maintainable.

    3. you want to debug/qa. struts is tested and kid approved. i'm going thru something right now where our system has bugs and no one really knows cuz different people have worked on each others code and did everything differently. and even on a huge project in the past i had done, it was still hard for me to figure out flows and such when they were scripted from page to page. a unified framework helps resolve those differences in coding and thusly, easier to debug.

    And I'm sure there's even more things that I haven't listed. One issue to really consider is do you want a page to page thing - which is good for proof of concept, quick and dirty. Or do you want something you can live with for the next year or so? Using a framework like struts will make your long term much easier.

    For the biggest project I worked on, a major airline portal, we rolled our own MVC framework. This was prior to struts and yet in the end, the code was very similar. Their system runs on over 100 Sun CPUs and has been cranking away since they launched a few years back, without a major crash or anything.

    This stuff does work and the bigger the project, the better. It's a little tough to get in the beginning, but after you implement it, you start to see that it makes sense. I feel tho, it's definitely more of an 'enterprise' thing than a small 20 page site; altho, u could use it for a small site if you wanted, no problem.

Always draw your curves, then plot your reading.

Working...