Skip to main content
main-content

Über dieses Buch

In this 100-page book, you will find that Stripes provides a very simple learning path, where you do not need to understand the entire framework in order to use it. The concept of this book is exactly that – to get you using the framework and writing code immediately. You will be off and running in no time, and adding to your skill set as we progress.

This book is written with exactly that learning method in mind. No filler, no empty explanations... just code. You won't be driving solo, however. Each code example is heavily annotated with comments and tips, so that you not only understand each snippet, but can also dive deeper if you so choose.

Stripes is a web framework for the Java programming language. It was initially released in 2005 by Tim Fennell. Despite its growth and maturity, Stripes has always focused on two key principles: simplicity and ease of development. Stripes has also remained a solution for a single application tier: the web-layer. Its purpose is to handle the interaction between a web browser and server-side java code. To tie these concepts together Stripes makes heavy use of Java annotations, which we will see as we learn the various features of Stripes.

Inhaltsverzeichnis

Frontmatter

Chapter 1. Introduction to Stripes

Stripes is a web framework for the Java programming language. It was initially released in 2005 by Tim Fennell. Despite its growth and maturity, Stripes has always focused on two key principles: simplicity and ease of development. Stripes has also remained a solution for a single application tier: the web layer. Its purpose is to handle the interaction between a web browser and server-side Java code. To tie these concepts together, Stripes makes heavy use of Java annotations, which you will see as you learn the various features of Stripes.
Brent Watson

Chapter 2. Getting Started

If you have any background in Java development, the setup for Stripes should be simple and familiar. If, on the other hand, you are new to Java development, the instructions in this chapter are detailed enough to guide you through the process, step by step.
Brent Watson

Chapter 3. ActionBeans

Now that your IDE is set up and you have all the files you need to build a Stripes application, you can build a fully working application. This chapter covers the main cornerstone of Stripes—the ActionBean. As you will see in this chapter, and throughout the rest of the book, you can’t do much in Stripes without ActionBeans. This stuff is important and also relatively simple, so pay attention. You’ve already seen the ActionBean introduced earlier in this book. Here we will dive into all the available features and functions of ActionBean classes.
Brent Watson

Chapter 4. Mapping URLs to Methods

In this chapter, you will see how to use two of the most common annotations in the Stripes Framework: @UrlBinding and @HandlesEvent.
Brent Watson

Chapter 5. JSP Pages

This chapter is all about the “view” layer of an application. For Java web applications, that of course means .jsp files. The JavaServer Pages (JSPs) that we create will contain both HTML and a small amount of JSTL (tag library) code that outputs variables from our ActionBeans. We’ve already seen one example of this in Chapter 3’s Listing 3-3.
Brent Watson

Chapter 6. Forms

The purpose of most web applications is to take some form of user input, do processing around that input—such as saving, updating, or retrieving data—and then passing another view to the user. Wash, rinse, repeat.
Brent Watson

Chapter 7. Working with Data

What good is data stored in DTOs and output as messages? Not much. This chapter will be an extension of the last chapter, but we will add a database backend to the application.
Brent Watson

Chapter 8. Interaction Between ActionBeans

This chapter will show how to put together what we’ve learned, by creating a simple application consisting of multiple pages and multiple ActionBeans. Our application will contain the following: LoginActionBean, which will be used to authenticate users; ApplicationMenuActionBean, which displays a menu to the user; and Page1ActionBean and Page2ActionBean, which are accessible from our menu. We also have a UserDAO object, which is a mock Data Access Object used to look up and authenticate usernames and passwords.
Brent Watson

Chapter 9. Validation

Data validation is a major headache for most web developers. Data must be validated for a number of potential problems before it can be used, such as checking for data that is blank/empty when it should not be (e.g., username fields), improperly formatted fields (e.g., phone numbers), invalid data types (e.g., age must be numeric), invalid lengths (e.g., password must be greater than six characters), and the list goes on.
Brent Watson

Chapter 10. Resolutions

So far we’ve seen two of Stripes resolutions: ForwardResolution, which is used to specify the JSP that will be run, and RedirectResolution, which is used to perform an HTTP redirect. Though Stripes actually has seven classes that implement the Resolution interface, only a few are commonly used. This chapter will explain some advanced features of RedirectResolution and extend our knowledge to include two additional resolutions: StreamingResolution, which is used to stream data back to the client (such as text or file data), and ErrorResolution, which takes an error number (e.g., 404) and a message to send back to the client.
Brent Watson

Chapter 11. Other Annotations

Stripes had the advantage of being built after Java 1.5 was released. This means that, unlike many other frameworks that rely heavily on XML configuration files (yuck!), the author (Tim Fennell) was able to take advantage of annotations. Stripes prides itself in the no-configuration stance it takes, and rightly so. This chapter covers the remainder of the annotations available in the Stripes framework.
Brent Watson

Chapter 12. Internationalization

Skip this chapter. Yes, you read that correctly. Don’t read it. That is unless what you are currently working on requires support for multiple languages. If not, my recommendation is to come back if and when this information is needed. Internationalization is difficult and configuration-heavy. You are better off learning the content of this chapter when it’s needed rather than learning it just to forget it.
Brent Watson

Chapter 13. Interceptors

Stripes provides a facility to add hooks at various stages of your application. These are called Stripes interceptors. Interceptors are classes that implement Stripes’ Interceptor interface and contain an intercept() method. Interceptors are a great way to do things like log requests or build security into an application.
Brent Watson

Chapter 14. File Uploads

As with Chapter 12, I suggest you skip this chapter and come back to it only if you find yourself needing file upload capabilities in your application.
Brent Watson

Chapter 15. Good Design

After using a framework for a number of years, you come across good design practices. This chapter covers good design practice with Stripes.
Brent Watson

Chapter 16. Next Steps

It’s hard to leave things out of a book. A book like this could easily be double or triple its size. The 80/20 rule (the Pareto Principle) is what I have tried to follow by covering the most commonly used parts of the Stripes framework. In doing so, I hope to have given you the best time-to-value ratio. Hopefully, you have been able to quickly consume this book and are now able to apply what you have learned.
Brent Watson

Backmatter

Weitere Informationen

Premium Partner

BranchenIndex Online

Die B2B-Firmensuche für Industrie und Wirtschaft: Kostenfrei in Firmenprofilen nach Lieferanten, Herstellern, Dienstleistern und Händlern recherchieren.

Whitepaper

- ANZEIGE -

Best Practices für die Mitarbeiter-Partizipation in der Produktentwicklung

Unternehmen haben das Innovationspotenzial der eigenen Mitarbeiter auch außerhalb der F&E-Abteilung erkannt. Viele Initiativen zur Partizipation scheitern in der Praxis jedoch häufig. Lesen Sie hier  - basierend auf einer qualitativ-explorativen Expertenstudie - mehr über die wesentlichen Problemfelder der mitarbeiterzentrierten Produktentwicklung und profitieren Sie von konkreten Handlungsempfehlungen aus der Praxis.
Jetzt gratis downloaden!

Bildnachweise