advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Reviews : Stripes Takes Struts to the Next Level :

Installation

The process of installing Struts and Stripes are almost similar. Both frameworks require their related .jar files to be included in the application server's classpath or the lib directory of the application. The web.xml file or the container needs to be modified to add the entries for the StripesFilter and the StripesDispatcher. Struts requires the additional step of creating a struts-config.xml file. Stripes will auto discover the action beans and create the config file by itself.

Developing the application using Stripes changes very few things. The application flow remains the same. In fact, the only things that change are the taglibs and the configuration (or the lack of configuration). To see the differences in the code, start with the main JSP page of both applications.

JSP Changes

Stripes comes with its own tag libraries, so the way they are included is different in both frameworks.
<%@ taglib prefix="stripes" 	uri="http://stripes.sourceforge.net/stripes.tld"%>
The Struts application uses the <html:form tag> to render an HTML form and the form action to configure an ActionMapping in the struts-config.xml. The Stripes application uses the <stripes:form> tag and sets the action as /stripeshello/actionbeans/GreetUser.action.

Struts has its own tags to render HTML form controls—like the <html:text property="name" /> tag, which renders a text field. In Stripes, you use the <stripes:text name="name" id="index.name" /> tag. Both tags have the same functionality in that they render an HTML 'input text' tag while allowing for localized messages. The <html:submit> tag from the Struts version compares to the <stripes:submit> in Stripes. Just like in Struts, the name attribute of the <stripes:submit> tag plays a very important role in determining the action that will be invoked. One major difference between the frameworks is the way the attributes for the form elements are defined; Stripes tries to stay close to the HTML specification, while Struts has its own attributes.

<stripes:submit name="welcome"><fmt:message key="index.button.submit"
bundle="${stripesMessages}" /></stripes:submit>

Action Bean Changes

So far, the differences between these frameworks have been minimal, but the action bean is where Struts and Stripes really diverge. Struts has Action and ActionForms while Stripes only has ActionBeans. The Stripes ActionBean combines the roles of both Struts' Action and ActionForms classes—namely, transferring data between the view and the model layers and processing that data. Struts requires you to extend the Action and ActionForms classes with the Struts Action and ActionForms classes and therefore you cannot extend any other class if you need to. The Stripes framework improves upon this by making ActionBean an interface. This makes it easier to extend the Action bean from any class. The Action bean also includes a getter and setter for the members, which is equivalent to the UserForm.java (ActionForm) in the Struts version.

Similar to Struts, Stripes provides access to the context through the getContext and setContext methods. The ActionBeanContext provides access to the Servlet API and all the variables in the Request, Response, and Session scopes.

The welcome method is similar to the execute method of the Struts action class. This is where the actual processing of data from the view is handled. After the processing is complete, it returns a Resolution object, which is basically the result of 'handler' methods. There can be any number of handler methods in an ActionBean. The runtime knows that the welcome method is a handler method through the name attribute of the <stripes:submit> tag in index.jsp. The name 'welcome' matches the name of the method. Stripes uses this name to find a handler method for the submit event. Next, you create and return a Resolution, which, in this case, is a ForwardResolution—to forward the request to greeting.jsp.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Avaya DevConnect Center
 Service Component Architecture/Service Data Objects Solution Center
 Intel Go Parallel Portal
 Internet.com eBook Library
 IBM Software Construction Toolbox
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 53
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Latest Linux Hits Networking Flaws
Metasploit 3.2 Offers More 'Evil Deeds'
'Thank You Apple. Seriously.'
The Buzz: BlackBerry App Store Seen Next
Is .NET on Linux Finally Ready?
Red Hat Takes on HPC Market, Microsoft
Python's New Release Bridges the Gap
No Flash Seen on iPhone Horizon
Apple Yields to Complaints Over iPhone NDA
Microsoft Shows Some Ankle With Visual Studio

Use Explicit Conversion Functions to Avert Reckless Implicit Conversions
Polyglot Programming: Building Solutions by Composing Languages
Automated testing for .NET by Ben Hall
"Supply Chain" SOA with SKOS
Service Component Architecture in Real Life
C++Ox: The Dawning of a New Standard
Getting Started with Virtualization
Master Complex Builds with MSBuild
eCryptfs: Single-File Encryption in Linux
CCXML in Action: A CCXML Auto Attendant

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES