SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Java Web Development with Stripes




                                Samuel Santos
About me
• Senior Java Engineer and Web Advocate at
  Present Technologies
• Open source enthusiast
• Web standards contributor
• Casual blogger




Present Technologies                         2
Agenda
•   Why
•   What is it
•   Goals
•   Setting up
•   Features
•   Extensions
•   Find more
•   Q&A
Present Technologies   3
Why


“Java web development doesn’t have to suck.”
                           Tim Fennell, Stripes author




Present Technologies                                 4
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
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
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
Setting up
<filter>
    <filter-name>StripesFilter</filter-name>
    <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
    <init-param>
         <param-name>ActionResolver.Packages</param-name>
         <param-value>com.example.javapt09.stripes.action</param-value>
    </init-param>
</filter>
<servlet>
    <servlet-name>DispatcherServlet</servlet-name>
    <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>DispatcherServlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>
<servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.action</url-pattern>
</servlet-mapping>



 Present Technologies                                                                     8
Features - Smart binding
 URLs binding


         public class SmartBindingActionBean extends BaseActionBean {
             ...
         }




<s:link beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean">Smart binding</s:link>
<s:link href="${contextPath}/SmartBinding.action">Smart binding</s:link>




  Present Technologies                                                                          9
Features - Smart binding
                                         <s:form beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean">
                                             <p>
                                                 <s:label for="user.firstName" />
                                                 <s:text id="user.firstName" name="user.firstName" />
    Parameters                               </p>
                                             <p>
                                                  <s:label for="user.lastName" />

    And Events                               </p>
                                             <p>
                                                  <s:text id="user.lastName" name="user.lastName" />


                                                  <s:submit name="print" />
                                             </p>
                                         </s:form>
public class SmartBindingActionBean extends BaseActionBean {
    @ValidateNestedProperties({
        @Validate(field = "firstName", required = true, maxlength = 100),
        @Validate(field = "lastName", required = true, maxlength = 100)
    })
    private User user;

    public User getUser() { return user; }
    public void setUser(User user) { this.user = user; }

    @DefaultHandler
    @DontValidate
    public Resolution main() {
        return new ForwardResolution("/WEB-INF/jsp/binding-validation.jsp");
    }

    public Resolution print() {
        getContext().getMessages().add(new LocalizableMessage(
                "com.example.javapt09.stripes.action.SmartBindingActionBean.print.success", user));
        return new RedirectResolution(SmartBindingActionBean.class);
    }
}
      Present Technologies                                                                                        10
Features - Smart binding
Localized buttons and labels
<s:form beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean">
    <p>
        <s:label for="user.firstName" />
        <s:text id="user.firstName" name="user.firstName" />
    </p>
    <p>
        <s:label for="user.lastName" />
        <s:text id="user.lastName" name="user.lastName" />
    </p>
    <p>
        <s:submit name="print" />
    </p>
</s:form>

com.example.javapt09.stripes.action.SmartBindingActionBean.user.firstName=First name
com.example.javapt09.stripes.action.SmartBindingActionBean.user.lastName=Last name
com.example.javapt09.stripes.action.SmartBindingActionBean.print=Print



 Present Technologies                                                             11
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
Features - Validation
Automatic maxlength on text inputs
public class SmartBindingActionBean extends BaseActionBean {

   @ValidateNestedProperties({
       @Validate(field = "firstName", required = true, maxlength = 100),
       @Validate(field = "lastName", required = true, maxlength = 100)
   })
   private User user;

    ...
}
<form action="/javapt09/SmartBinding.action" method="post">
    <p>
        <label for="user.firstName">First name</label>
        <input id="user.firstName" maxlength="100" name="user.firstName" type="text" />
    </p>
    <p>
         <label for="user.lastName">Last name</label>
         <input id="user.lastName" maxlength="100" name="user.lastName" type="text" />
    </p>
    <p>
         <input name="print" value="Print" type="submit" />
    </p>
</form>

 Present Technologies                                                                     13
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
Features - Validation
Displaying errors and messages
• Messages
   <s:messages />

• All errors
   <s:errors />

• Specific field error
   <s:errors field="user.firstName" />



Present Technologies                     15
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
Features - Layouts
Reusable layout
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<s:layout-definition>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>${title}</title>
        <link rel="stylesheet" type="text/css" href="${contextPath}/css/style.css" />
    </head>
    <body>
        <div id="header">
            <span class="title">${title}</span>
        </div>
        <div id="body">
            <s:layout-component name="body" />
        </div>
    </body>
</html>
</s:layout-definition>




Present Technologies                                                                    17
Features - Layouts
Using a reusable layout to render a page
<%@include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<s:layout-render name="/WEB-INF/jsp/common/layout-main.jsp"
    title="JavaPT09 - Stripes » Layouts">
    <s:layout-component name="body">
        <p>Main page content...</p>
    </s:layout-component>
</s:layout-render>




Present Technologies                                          18
Features - Layouts
Final result
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>JavaPT09 - Stripes » Layouts</title>
        <link rel="stylesheet" type="text/css" href="/javapt09/css/style.css" />
    </head>
    <body>
        <div id="header">
            <span class="title">JavaPT09 - Stripes » Layouts</span>
        </div>
        <div id="body">
            <p>Main page content...</p>
        </div>
    </body>
</html>




Present Technologies                                                               19
Features - Exception handling
<init-param>
    <param-name>DelegatingExceptionHandler.Packages</param-name>
    <param-value>com.example.javapt09.stripes.exception</param-value>
</init-param>


public class DefaultExceptionHandler implements AutoExceptionHandler {
    public Resolution handle(Exception exception,
            HttpServletRequest request, HttpServletResponse response) {
        // Handle Exception
        return new ForwardResolution(ErrorActionBean.class);
    }

    public Resolution handle(IOException exception,
            HttpServletRequest request, HttpServletResponse response) {
        // Handle IOException
        return new ForwardResolution(ErrorActionBean.class);
    }
}



Present Technologies                                                      20
Features - Exception handling
Don’t catch your exceptions

public Resolution handledException() throws IOException {
    throw new IOException("Handled exception");
}

public Resolution unhandledException() throws Exception {
    throw new Exception("Unhandled exception");
}




Present Technologies                                        21
Features - Interceptors
Built-in interceptors
@Before(stages = LifecycleStage.BindingAndValidation)
public void prepareSomeStuff() {
    // load data from the DB
}




Stripes request processing lifecycle stages:
RequestInit             ActionBeanResolution HandlerResolution
BindingAndValidation CustomValidation           EventHandling
ResolutionExecution     RequestComplete


 Present Technologies                                            22
Features - Interceptors
Custom interceptors
public interface Interceptor {
    Resolution intercept(ExecutionContext context) throws Exception;
}


@Intercepts(LifecycleStage.ActionBeanResolution)
public class EJBInterceptor implements Interceptor {

       public Resolution intercept(ExecutionContext context) throws Exception {
           ...
       }

}




    Present Technologies                                                  23
Features - Easy Ajax integration
public class AjaxActionBean extends BaseActionBean {
    private List<String> cities = new ArrayList<String>();

      public Resolution load() {
          return new JavaScriptResolution(cities);
      }
}

<div id="cities"></div>
<script type="text/javascript">
    var client = new XMLHttpRequest();
    client.open("GET", "${contextPath}/Ajax.action?load=");
    client.onreadystatechange = function() {
        if (this.readyState == 4) {
            var cities = eval(client.responseText);
            var citiesList = "";
            for (var i = 0; i < cities.length; i++) {
              citiesList += "<li>" + cities[i] + "</li>";
            }
            document.getElementById("cities").innerHTML = "<ul>" + citiesList + "</ul>";
        }
    }
    client.send(null);
</script>
    Present Technologies                                                         24
Features - File download


public class DownloadActionBean extends BaseActionBean {
    @DefaultHandler
    public Resolution main() throws FileNotFoundException {
        String fileName = "stripes.png";
        String filePath = getContext().getServletContext().getRealPath("/img/" + fileName);
        return new StreamingResolution("image/png",
                new FileInputStream(filePath)).setFilename(fileName);
    }
}




 Present Technologies                                                                  25
Features - File upload
File upload form

<s:form beanclass="com.example.javapt09.stripes.action.UploadActionBean"
    enctype="multipart/form-data">
    <p>
        <s:file name="fileBean" />
    </p>
    <p>
        <s:submit name="upload" />
    </p>
</s:form>




Present Technologies                                                       26
Features - File upload
Saving the file
public class UploadActionBean extends BaseActionBean {
    private FileBean fileBean;
    public FileBean getFileBean() { return fileBean; }
    public void setFileBean(FileBean fileBean) { this.fileBean = fileBean; }

    @DefaultHandler
    public Resolution main() {
        return new ForwardResolution("/WEB-INF/jsp/file-upload.jsp");
    }

    public Resolution upload() throws IOException {
        fileBean.getFileName();
        fileBean.getSize();
        fileBean.getContentType();
        // fileBean.save(new File());

        return new ForwardResolution("/WEB-INF/jsp/file-upload.jsp");
    }
}
Present Technologies                                                           27
Features - Extension/customization
• Stripes uses auto-discovery to find extensions
   <init-param>
       <param-name>Extension.Packages</param-name>
       <param-value>com.example.javapt09.stripes.extensions</param-value>
   </init-param>


• The specified packages will be scanned for
  extensions like interceptors, formatters, type
  converters, exception handlers, etc
   @Validate(maxlength = 100, converter = EmailTypeConverter.class)
   private String email;




Present Technologies                                                        28
Extensions
• Spring integration (built-in)
         http://www.stripesframework.org/display/stripes/Spring
           +with+Stripes
• EJB3 integration
         http://code.google.com/p/stripes-ejb3




Present Technologies                                          29
Extensions
• Stripes Security (roles based)
         http://www.stripesframework.org/display/stripes/Securi
           ng+Stripes+With+ACLs
• Stripes Security (custom authorization)
         http://www.stripesframework.org/display/stripes/Securit
           y+Interceptor+for+custom+authorization




Present Technologies                                           30
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
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
Q&A




Present Technologies   33
Contacts
• Present Technologies
         http://www.present-technologies.com
• Blog
         http://www.samaxes.com
• Twitter
         http://twitter.com/samaxes




Present Technologies                           34

Mais conteúdo relacionado

Mais procurados

BPM-1 Introduction to Advanced Workflows
BPM-1 Introduction to Advanced WorkflowsBPM-1 Introduction to Advanced Workflows
BPM-1 Introduction to Advanced WorkflowsAlfresco Software
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveAlfresco Software
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVCAcquisio
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
ILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseRené Winkelmeyer
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryPamela Fox
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"GeeksLab Odessa
 
Dom selecting & jQuery
Dom selecting & jQueryDom selecting & jQuery
Dom selecting & jQueryKim Hunmin
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletonGeorge Nguyen
 
JSP Syntax_1
JSP Syntax_1JSP Syntax_1
JSP Syntax_1brecke
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJSAaronius
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsIMC Institute
 
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...Atlassian
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011Arun Gupta
 
JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about youAlexander Casall
 
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...Atlassian
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.jsMeir Rotstein
 

Mais procurados (20)

BPM-1 Introduction to Advanced Workflows
BPM-1 Introduction to Advanced WorkflowsBPM-1 Introduction to Advanced Workflows
BPM-1 Introduction to Advanced Workflows
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
BPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep DiveBPM-3 Advanced Workflow Deep Dive
BPM-3 Advanced Workflow Deep Dive
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Planbox Backbone MVC
Planbox Backbone MVCPlanbox Backbone MVC
Planbox Backbone MVC
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
ILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterpriseILUG 2010 - Deploying plug-ins to the enterprise
ILUG 2010 - Deploying plug-ins to the enterprise
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & Witchery
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Dom selecting & jQuery
Dom selecting & jQueryDom selecting & jQuery
Dom selecting & jQuery
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
JSP Syntax_1
JSP Syntax_1JSP Syntax_1
JSP Syntax_1
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
AngularJS On-Ramp
AngularJS On-RampAngularJS On-Ramp
AngularJS On-Ramp
 
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
 
JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about you
 
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluen...
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.js
 

Semelhante a Java Web Development with Stripes

Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 
AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014Dariusz Kalbarczyk
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in RailsSeungkyun Nam
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015Pushkar Chivate
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkara JUG
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Arun Gupta
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Joao Lucas Santana
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Arun Gupta
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
 

Semelhante a Java Web Development with Stripes (20)

Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014AngularJS Mobile Warsaw 20-10-2014
AngularJS Mobile Warsaw 20-10-2014
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in Rails
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
JS-05-Handlebars.ppt
JS-05-Handlebars.pptJS-05-Handlebars.ppt
JS-05-Handlebars.ppt
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
Django Vs Rails
Django Vs RailsDjango Vs Rails
Django Vs Rails
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFaces
 
4. jsp
4. jsp4. jsp
4. jsp
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
 
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
Spark IT 2011 - Simplified Web Development using Java Server Faces 2.0
 
Step By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts AppStep By Step Guide For Buidling Simple Struts App
Step By Step Guide For Buidling Simple Struts App
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Java Web Development with Stripes

  • 1. Java Web Development with Stripes Samuel Santos
  • 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
  • 4. Why “Java web development doesn’t have to suck.” Tim Fennell, Stripes author Present Technologies 4
  • 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
  • 8. Setting up <filter> <filter-name>StripesFilter</filter-name> <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class> <init-param> <param-name>ActionResolver.Packages</param-name> <param-value>com.example.javapt09.stripes.action</param-value> </init-param> </filter> <servlet> <servlet-name>DispatcherServlet</servlet-name> <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <filter-mapping> <filter-name>StripesFilter</filter-name> <servlet-name>DispatcherServlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <servlet-mapping> <servlet-name>DispatcherServlet</servlet-name> <url-pattern>*.action</url-pattern> </servlet-mapping> Present Technologies 8
  • 9. Features - Smart binding URLs binding public class SmartBindingActionBean extends BaseActionBean { ... } <s:link beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean">Smart binding</s:link> <s:link href="${contextPath}/SmartBinding.action">Smart binding</s:link> Present Technologies 9
  • 10. Features - Smart binding <s:form beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean"> <p> <s:label for="user.firstName" /> <s:text id="user.firstName" name="user.firstName" /> Parameters </p> <p> <s:label for="user.lastName" /> And Events </p> <p> <s:text id="user.lastName" name="user.lastName" /> <s:submit name="print" /> </p> </s:form> public class SmartBindingActionBean extends BaseActionBean { @ValidateNestedProperties({ @Validate(field = "firstName", required = true, maxlength = 100), @Validate(field = "lastName", required = true, maxlength = 100) }) private User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; } @DefaultHandler @DontValidate public Resolution main() { return new ForwardResolution("/WEB-INF/jsp/binding-validation.jsp"); } public Resolution print() { getContext().getMessages().add(new LocalizableMessage( "com.example.javapt09.stripes.action.SmartBindingActionBean.print.success", user)); return new RedirectResolution(SmartBindingActionBean.class); } } Present Technologies 10
  • 11. Features - Smart binding Localized buttons and labels <s:form beanclass="com.example.javapt09.stripes.action.SmartBindingActionBean"> <p> <s:label for="user.firstName" /> <s:text id="user.firstName" name="user.firstName" /> </p> <p> <s:label for="user.lastName" /> <s:text id="user.lastName" name="user.lastName" /> </p> <p> <s:submit name="print" /> </p> </s:form> com.example.javapt09.stripes.action.SmartBindingActionBean.user.firstName=First name com.example.javapt09.stripes.action.SmartBindingActionBean.user.lastName=Last name com.example.javapt09.stripes.action.SmartBindingActionBean.print=Print Present Technologies 11
  • 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
  • 13. Features - Validation Automatic maxlength on text inputs public class SmartBindingActionBean extends BaseActionBean { @ValidateNestedProperties({ @Validate(field = "firstName", required = true, maxlength = 100), @Validate(field = "lastName", required = true, maxlength = 100) }) private User user; ... } <form action="/javapt09/SmartBinding.action" method="post"> <p> <label for="user.firstName">First name</label> <input id="user.firstName" maxlength="100" name="user.firstName" type="text" /> </p> <p> <label for="user.lastName">Last name</label> <input id="user.lastName" maxlength="100" name="user.lastName" type="text" /> </p> <p> <input name="print" value="Print" type="submit" /> </p> </form> Present Technologies 13
  • 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
  • 17. Features - Layouts Reusable layout <%@include file="/WEB-INF/jsp/common/taglibs.jsp" %> <s:layout-definition> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>${title}</title> <link rel="stylesheet" type="text/css" href="${contextPath}/css/style.css" /> </head> <body> <div id="header"> <span class="title">${title}</span> </div> <div id="body"> <s:layout-component name="body" /> </div> </body> </html> </s:layout-definition> Present Technologies 17
  • 18. Features - Layouts Using a reusable layout to render a page <%@include file="/WEB-INF/jsp/common/taglibs.jsp" %> <s:layout-render name="/WEB-INF/jsp/common/layout-main.jsp" title="JavaPT09 - Stripes » Layouts"> <s:layout-component name="body"> <p>Main page content...</p> </s:layout-component> </s:layout-render> Present Technologies 18
  • 19. Features - Layouts Final result <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>JavaPT09 - Stripes » Layouts</title> <link rel="stylesheet" type="text/css" href="/javapt09/css/style.css" /> </head> <body> <div id="header"> <span class="title">JavaPT09 - Stripes » Layouts</span> </div> <div id="body"> <p>Main page content...</p> </div> </body> </html> Present Technologies 19
  • 20. Features - Exception handling <init-param> <param-name>DelegatingExceptionHandler.Packages</param-name> <param-value>com.example.javapt09.stripes.exception</param-value> </init-param> public class DefaultExceptionHandler implements AutoExceptionHandler { public Resolution handle(Exception exception, HttpServletRequest request, HttpServletResponse response) { // Handle Exception return new ForwardResolution(ErrorActionBean.class); } public Resolution handle(IOException exception, HttpServletRequest request, HttpServletResponse response) { // Handle IOException return new ForwardResolution(ErrorActionBean.class); } } Present Technologies 20
  • 21. Features - Exception handling Don’t catch your exceptions public Resolution handledException() throws IOException { throw new IOException("Handled exception"); } public Resolution unhandledException() throws Exception { throw new Exception("Unhandled exception"); } Present Technologies 21
  • 22. Features - Interceptors Built-in interceptors @Before(stages = LifecycleStage.BindingAndValidation) public void prepareSomeStuff() { // load data from the DB } Stripes request processing lifecycle stages: RequestInit ActionBeanResolution HandlerResolution BindingAndValidation CustomValidation EventHandling ResolutionExecution RequestComplete Present Technologies 22
  • 23. Features - Interceptors Custom interceptors public interface Interceptor { Resolution intercept(ExecutionContext context) throws Exception; } @Intercepts(LifecycleStage.ActionBeanResolution) public class EJBInterceptor implements Interceptor { public Resolution intercept(ExecutionContext context) throws Exception { ... } } Present Technologies 23
  • 24. Features - Easy Ajax integration public class AjaxActionBean extends BaseActionBean { private List<String> cities = new ArrayList<String>(); public Resolution load() { return new JavaScriptResolution(cities); } } <div id="cities"></div> <script type="text/javascript"> var client = new XMLHttpRequest(); client.open("GET", "${contextPath}/Ajax.action?load="); client.onreadystatechange = function() { if (this.readyState == 4) { var cities = eval(client.responseText); var citiesList = ""; for (var i = 0; i < cities.length; i++) { citiesList += "<li>" + cities[i] + "</li>"; } document.getElementById("cities").innerHTML = "<ul>" + citiesList + "</ul>"; } } client.send(null); </script> Present Technologies 24
  • 25. Features - File download public class DownloadActionBean extends BaseActionBean { @DefaultHandler public Resolution main() throws FileNotFoundException { String fileName = "stripes.png"; String filePath = getContext().getServletContext().getRealPath("/img/" + fileName); return new StreamingResolution("image/png", new FileInputStream(filePath)).setFilename(fileName); } } Present Technologies 25
  • 26. Features - File upload File upload form <s:form beanclass="com.example.javapt09.stripes.action.UploadActionBean" enctype="multipart/form-data"> <p> <s:file name="fileBean" /> </p> <p> <s:submit name="upload" /> </p> </s:form> Present Technologies 26
  • 27. Features - File upload Saving the file public class UploadActionBean extends BaseActionBean { private FileBean fileBean; public FileBean getFileBean() { return fileBean; } public void setFileBean(FileBean fileBean) { this.fileBean = fileBean; } @DefaultHandler public Resolution main() { return new ForwardResolution("/WEB-INF/jsp/file-upload.jsp"); } public Resolution upload() throws IOException { fileBean.getFileName(); fileBean.getSize(); fileBean.getContentType(); // fileBean.save(new File()); return new ForwardResolution("/WEB-INF/jsp/file-upload.jsp"); } } Present Technologies 27
  • 28. Features - Extension/customization • Stripes uses auto-discovery to find extensions <init-param> <param-name>Extension.Packages</param-name> <param-value>com.example.javapt09.stripes.extensions</param-value> </init-param> • The specified packages will be scanned for extensions like interceptors, formatters, type converters, exception handlers, etc @Validate(maxlength = 100, converter = EmailTypeConverter.class) private String email; Present Technologies 28
  • 29. Extensions • Spring integration (built-in) http://www.stripesframework.org/display/stripes/Spring +with+Stripes • EJB3 integration http://code.google.com/p/stripes-ejb3 Present Technologies 29
  • 30. Extensions • Stripes Security (roles based) http://www.stripesframework.org/display/stripes/Securi ng+Stripes+With+ACLs • Stripes Security (custom authorization) http://www.stripesframework.org/display/stripes/Securit y+Interceptor+for+custom+authorization Present Technologies 30
  • 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
  • 34. Contacts • Present Technologies http://www.present-technologies.com • Blog http://www.samaxes.com • Twitter http://twitter.com/samaxes Present Technologies 34