Apache Struts 2 Web Application Development - Helion
Tytuł oryginału: Apache Struts 2 Web Application Development.
ISBN: 9781847193407
stron: 384, Format: ebook
Data wydania: 2009-06-15
Księgarnia: Helion
Cena książki: 84,99 zł
Struts 2.1 is a modern, extensible, agile web application framework suitable for both small- and large-scale web applications.
The book begins with a comprehensive look at Struts 2.1 basics, interspersed with detours into more advanced development topics. You'll learn about configuring Struts 2.1 actions, results, and interceptors via both XML and Java annotations. You'll get an introduction to most of the Struts 2.1 custom tags and learn how they can assist in rapid application prototyping and development.
From there you'll make your way into Struts 2.1's strong support for form validation and type conversion, which allows you to treat your form values as domain objects without cluttering your code. A look at Struts 2.1's interceptors is the final piece of the Struts 2.1 puzzle, allowing you to leverage the standard Struts 2 interceptors as well as implement your own custom behavior.
After covering Struts 2.1 you'll journey into the world of JavaScript, a surprisingly capable language, the Document Object Model (DOM), and CSS, and learn how to create clean and concise client-side behavior. You'll leverage that knowledge as you move on to Struts 2 themes and templates, which give you a powerful way to encapsulate site-wide user interface behavior.
The book closes with a look at some tools that make the application development life cycle easier to manage, particularly in a team environment, and more automatic.
Osoby które kupowały "Apache Struts 2 Web Application Development", wybierały także:
- Windows Media Center. Domowe centrum rozrywki 66,67 zł, (8,00 zł -88%)
- Ruby on Rails. Ćwiczenia 18,75 zł, (3,00 zł -84%)
- Przywództwo w świecie VUCA. Jak być skutecznym liderem w niepewnym środowisku 58,64 zł, (12,90 zł -78%)
- Scrum. O zwinnym zarządzaniu projektami. Wydanie II rozszerzone 58,64 zł, (12,90 zł -78%)
- Od hierarchii do turkusu, czyli jak zarządzać w XXI wieku 58,64 zł, (12,90 zł -78%)
Spis treści
Apache Struts 2 Web Application Development eBook -- spis treści
- Apache Struts 2 Web Application Development
- Table of Contents
- Apache Struts 2 Web Application Development
- Credits
- About the Author
- Acknowledgement
- About the Reviewers
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code for the book
- Errata
- Piracy
- Questions
- 1. Struts and Agile Development
- Struts 2 in a nutshell
- The filter dispatcher
- Interceptors
- Actions
- Results
- Plug-ins
- Agile in a nutshell
- User stories
- Testing
- Refactoring
- Short iterations
- Real applications in a nutshell
- Making it pretty
- JavaScript
- Documentation
- All of the rest
- Getting started
- Creating our own applications
- Doing it "by hand"
- Using Maven
- Creating our own applications
- Summary
- Struts 2 in a nutshell
- 2. Basic Configuration
- Setting up our environment
- A sanity-checking application
- Configuring web.xml for Struts 2
- Writing our first action
- Configuring our first action with XML
- Configuring our result
- Choosing an action method
- Getting started with our application
- Gathering user storiesdefining our application
- Building skeletal applications using wildcards
- Matching multiple wildcards
- More wildcard tricks
- Packages and namespaces
- Creating site navigation
- Including external configuration files
- Our application so far
- Examining our configuration
- Configuration via convention and annotations
- The Convention Plug-in and action-less actions
- The Convention Plug-in and action configuration
- Configuring the Convention Plug-in with annotations
- Summary
- Setting up our environment
- 3. Actions and ActionSupport
- ActionSupport and its interfaces
- The Action interface
- Actions convenience strings
- The TextProvider interface
- Detouraction properties, JSPs, and more tags
- Continuing with message lookup
- Parameterized messages
- The LocaleProvider interface
- The Validateable and ValidationAware interfaces
- The Action interface
- Implementing our first user story
- Refining our story
- Creating the recipe form
- Adding some validation
- Displaying our error messages
- More action interfaces
- Detourcreating the list of interfaces to explore
- Leveraging the IDE
- Using the command line
- Examining class files
- Detourcreating the list of interfaces to explore
- Additional action interfaces
- Preparable interface
- Accessing scoped attributes (and request parameters)
- Accessing servlet objects
- Request parameter/action property filtering
- Summary
- ActionSupport and its interfaces
- 4. Results and Result Types
- The dispatcher result type
- The redirect result type
- The redirectAction result type
- The chain result type (action chaining)
- The parse parameter and a usecase detour
- Displaying the form
- Coding our action
- Configuring our success result
- Type conversion sneak attack
- Coding the show action
- The FreeMarker and Velocity result types
- FreeMarker result configuration
- The XSLT result type
- The plaintext result
- The stream result
- The httpheader result
- The Tiles and JasperReports results
- Creating custom result types
- Configuring our custom result type
- Writing the action
- Implementing our markdown result type
- Summary
- 5. OGNL, the Value Stack, and Custom Tags
- OGNL
- Contents of the value stack and the <s:property> tag
- Escaping values
- Default values
- Escaping values for JavaScript
- Other value stack objects and the debug tag
- A dirty EL trick
- Contents of the value stack and the <s:property> tag
- The <s:set> tag
- Calling static methods from OGNL
- Conditionals
- Collections and iteration
- The <s:iterator> tag
- Tracking iteration status
- CSS detour: Alternating table row background color
- The <s:generator> tag
- It's not a list, it's an iterator!
- Silent death
- Another potential stumper (Struts 2.0 only)
- What is <s:generator> for?
- The <s:append> tag
- The <s:merge> tag
- The <s:subset> tag
- Arbitrary filtering with the <s:subset> tag
- Dirty OGNL secrets
- The <s:sort> tag
- Are the collection tags useful?
- The <s:iterator> tag
- Referencing other pages and actions
- The <s:include> tag
- The <s:action> tag
- The <s:url> tag
- Summary
- OGNL
- 6. Form Tags
- Form tag basics
- The "xhtml" theme in a nutshell
- The <s:head> tag
- The <s:form> tag
- Common input element tag attributes
- Values, labels, and names (and keys)
- All the rest
- Basic rendering
- But I don't want tables
- Basic form input elements
- The <s:textfield>, <s:password>, and <s:hidden> tags
- The <s:textarea> tag
- The <s:label> tag
- The <s:radio> tag
- The <s:checkbox> tag
- The <s:checkboxlist> tag
- Using the <s:checkboxlist> tag to implement a user story
- The <s:select> tag
- The <s:optgroup> tag
- The <s:submit> tag
- The <s:reset> tag
- Combination form tags
- <s:combobox> tag
- The <s:updownselect> tag
- The <s:optiontransferselect> tag
- The <s:doubleselect> tag
- Uploading files
- Preventing double submits with the <s:token> tag
- Summary
- Form tag basics
- 7. Form Validation and Type Conversion
- Form validation
- Manual validation
- Configuring XML validation
- Customizing validation messages
- What validations are available?
- The requiredstring validator
- The stringlength validator
- Detourplaying games with validation messages
- The required and int validators
- But wait, there's more
- The double validator
- The email validator
- The url validator
- The date validator
- The regex validator
- The expression and fieldexpression validators
- Combining validation methods
- The conversion validator
- The visitor validator
- Configuring validation with annotations
- The @Validation annotation
- The @Validations annotation
- The @SkipValidation annotation
- The @RequiredFieldValidator annotation
- The @IntRangeFieldValidator annotation
- The @DoubleRangeFieldValidator annotation
- The remaining validation annotations
- Client-side validation
- Custom validators
- Type conversion
- The problem
- The solution
- Defining our own converters
- Type conversion usecasetrimmed BigDecimals
- Configuring conversion across the entire application
- Custom type conversion is handy
- Collections
- Usecaseadding a list of ingredients
- Why add addIngredient()?
- Updating our new recipe form
- Map-based collections
- Usecaseadding a list of ingredients
- Summary
- Form validation
- 8. Interceptors
- The basics
- Configuring interceptor stacks
- Configuring interceptors
- Configuring interceptors for individual actions
- How interceptors work
- Interceptors in the default stack
- The exception interceptor
- The alias interceptor
- The servletConfig interceptor
- The prepare interceptor
- The i18n interceptor
- The chain interceptor
- The debugging interceptor
- The profiling interceptor
- The scopedModelDriven interceptor
- The modelDriven interceptor
- Getting back to the scopedModelDriven interceptor
- The fileUpload interceptor
- The checkbox interceptor
- The staticParams interceptor
- The params interceptor
- Ordered parameters and ad hoc factory patterns
- The conversionError interceptor
- The validation interceptor
- The workflow interceptor
- Other important interceptors and interceptor stacks
- The token interceptor
- The store interceptor
- The roles Interceptor
- The clearSession interceptor
- The paramsPrepareParamsStack interceptor stack
- Writing our own interceptors
- The trim interceptor
- Configuring the trim interceptor
- The Test Action
- Testing the trim interceptor
- Modifying application flow with interceptors
- Configuring the result
- Writing the ResultMappingInterceptor
- Writing the ResultMappingInterceptor and making it work
- Summary
- The basics
- 9. Exceptions and Logging
- Handling exceptions in Struts 2
- Global exception mappings
- Action-specific exception mappings
- Accessing the exception
- Architecting exceptions and exception handling
- Checked versus unchecked exceptions
- Application-specific exceptions
- Abstracting underlying exceptions
- Handling exceptions
- Logging
- Introduction to logging
- Using the loggers
- Configuring the loggers
- Introduction to logging
- Summary
- Handling exceptions in Struts 2
- 10. Getting Started with JavaScript
- Introduction to JavaScript
- Playing with JavaScript
- Minor syntax and language notes
- Unicode
- Whitespace
- Semicolons
- Null and undefined values
- The equal and strict equal operators
- The logical OR operator
- Variables and scoping
- JavaScript data types
- Numbers
- Decimal, hex, octal
- Conversions
- Strings
- Length and conversions
- Conversions to other types
- Arrays
- Array functions
- Numbers
- JavaScript data types
- Exception handling
- Introduction to JavaScript objects and OOP
- Open objects and object augmentation
- Object values can be functions
- Object maker functions
- Functions
- Function parameters
- Some trickery
- Inner functions
- Closures
- Function parameters
- Introduction to JavaScript classes
- Creating classes
- Variable and function access
- JavaScript's "this" keyword
- Prototypes
- Creating classes
- JavaScript modules and OOP
- Creating a namespace
- Summary
- Introduction to JavaScript
- 11. Advanced JavaScript, the DOM, and CSS
- The importance of markup
- ID or style attribute?
- Dressing up our form
- JavaScript modules and jQuery
- Adding onclick handlers
- Using a function builder
- Of what value is this
- Accessing module data
- The final trick
- Using a function builder
- Adding dynamic form elements
- Identifying where to add the elements
- The JavaScript "Recipe" module
- Summary
- The importance of markup
- 12. Themes and Templates
- Extracting the templates
- A maze of twisty little passages
- Creating our theme
- Other uses of templates
- Summary
- 13. Rich Internet Applications
- What this chapter is and isn't
- Dojo tags
- Simple use cases really are simple
- The Dojo <sx:head> tag
- The Dojo <sx:a> tag
- A brief side journey on topics
- The Dojo <sx:div> tag
- Finishing our user story
- Highlighting the need to know
- Dojo and forms
- The REST plug-in
- REST in a nutshell
- The REST plug-in in a nutshell
- REST plug-in URLs
- REST plug-in results
- A web browser client example
- The REST controller
- REST controller responses
- An example of a useful client
- A command-line example
- Custom content handler example
- YAML in a nutshell
- Writing our YAML handler
- Configuring our YAML handler
- Handling our YAML
- Summary
- 14. Comprehensive Testing
- Test-driven development
- Pay as we go
- Unit testing
- Unit tests focus code intent
- Keep tests small
- Test, code, refactorthe "heartbeat" of TDD
- JUnit
- Revisiting our iterator filter
- The test environment
- The initial test stub
- Testing vowel recognition
- Testing non-string parameter exceptions
- Test granularity and test setup
- TestNG
- Legacy code and unit testing
- Simple action testing
- Detour: Dependency Injection (Inversion of Control)
- Dependency Injection helps us test
- Detour: Struts and Spring in a nutshell
- Spring web.xml configuration
- Spring context configuration file
- Testing Struts 2 in context
- Testing a Struts interceptor
- Client-side (functional) testing
- Selenium
- Selenium RC
- The test scenario
- Our first Selenium test
- Selenium
- Other forms of testing
- Acceptance testing
- Load testing
- Load testing with JMeter
- Recovery testing
- Summary
- Test-driven development
- 15. Documenting our Application
- Documenting Java
- Self-documenting code
- Document why, not what
- Make your code read like the problem
- Contract-oriented programming
- SpringContracts
- Getting into details
- Javadocs
- Always write Javadocs!
- The first sentence
- Add information beyond the API name
- Write for multiple formats
- Generating targeted Javadocs
- Visibility
- The -exclude argument
- The -use argument
- Creating new Javadoc tags with the -tag argument
- Never write Javadocs!
- Never write inline Java comments!
- Using UML
- Package diagrams
- Class diagrams
- Sequence diagrams
- Self-documenting code
- Documenting web applications
- High-level overviews
- Documenting JSPs
- Documenting JavaScript
- Documenting interaction
- More UML and the power of scribbling
- Don't spend so much time making pretty pictures
- User documentation
- Documenting development
- Source code control systems
- Code and mental history
- Commit comment commitment
- When (and what) do we commit
- Branching
- Branching discipline
- Issue and bug management
- Linking to the SCCS
- Wikis
- RSS and IRC/chat systems
- Word processor documents
- Source code control systems
- Summary
- Documenting Java
- Index