Stripes presentation for the Portuguese JUG session at JavaPT09 event.
Last version available at Speaker Deck: http://speakerdeck.com/samaxes/java-web-development-with-stripes.
2. About me
• Senior Java Engineer and Web Advocate at
Present Technologies
• Open source enthusiast
• Web standards contributor
• Casual blogger
Present Technologies 2
3. Agenda
• Why
• What is it
• Goals
• Setting up
• Features
• Extensions
• Find more
• Q&A
Present Technologies 3
5. Why
“Have you ever used a framework and felt you
had to do too much work for the framework
compared to what the framework gave you in
return?”
Freddy Daoud, Stripes Book
Present Technologies 5
6. What is it
• Stripes is a Model-View-Controller (MVC)
framework
• Stripes is not a “full-stack” framework
• Stripes is an action-based framework
Present Technologies 6
7. Goals
• Make developing web applications in Java
easy
• Provide simple yet powerful solutions to
common problems
• Make the Stripes ramp up time for a new
developer less than 30 minutes
• Make it really easy to extend Stripes, without
making you configure every last thing
From Stripes Homepage
Present Technologies 7
12. Features - Validation
Frequently used @Validate attributes
Attribute Type Description
field String Name of nested field to validate.
required boolean true indicates a required field.
on String[] Event handlers for which to apply.
minlength int Minimum length of input.
maxlength int Maximum length of input.
expression String EL expression to validate the input.
mask String Regular expression that the input must match.
minvalue double Minimum numerical value of input.
maxvalue double Maximum numerical value of input.
converter Class Type converter to use on the input.
Present Technologies 12
14. Features - Validation
Custom Validation
@ValidationMethod
public void validate(ValidationErrors errors) {
if (user.getLastName().equals(user.getFirstName())) {
errors.add("lastName",
new SimpleError("First and last name must be different!"));
}
}
Present Technologies 14
15. Features - Validation
Displaying errors and messages
• Messages
<s:messages />
• All errors
<s:errors />
• Specific field error
<s:errors field="user.firstName" />
Present Technologies 15
16. Features - Customizable URLs
Clean URLs
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/action/*</url-pattern>
</servlet-mapping>
@UrlBinding("/action/cleanURL/{$event}/{city}")
public class CustomizableURLActionBean extends BaseActionBean {
private String city;
public Resolution delete() { ... }
}
Present Technologies 16
31. Extensions
• Stripes-Reload
Plugin for Stripes 1.5 that reloads modifications
made to your Action Beans, Type Converters,
Formatters, and Resource Bundles without having to
restart your server
http://www.stripesbook.org/stripes-reload.html
Present Technologies 31
32. Find more
• Stripes Framwork
http://www.stripesframework.org
• Stripes Book: Stripes ...and Java Web
Development Is Fun Again
http://www.pragprog.com/titles/fdstr
Present Technologies 32