Book Image

Apache Struts 2 Web Application Development

By : Dave Newton
Book Image

Apache Struts 2 Web Application Development

By: Dave Newton

Overview of this book

<p>Struts 2.1 is a modern, extensible, agile web application framework suitable for both small- and large-scale web applications.<br /><br />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.<br /><br />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.<br /><br />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.<br /><br />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.</p>
Table of Contents (21 chapters)
Apache Struts 2 Web Application Development
Credits
About the Author
Acknowledgement
About the Reviewers
Preface

The <s:set> tag


The set tag assigns the results of an OGNL expression to a variable, optionally setting a scope (defaults to action scope, rather than the four typical servlet scopes). This tag is useful when we have a complicated or deeply nested expression, we need to access it over and over again, and don't want to type much. Such deeply nested expressions can also be very computationally expensive. Using an<s:set> tag can save typing as well as execution time.

<s:set name="shorter" value="deeply.nested.value.getter"/>
...
<s:property value="#shorter"/>

The "#" character is now optional—current documentation doesn't reflect this. We can also reference stack context values without the leading "#".