Chapter 6. Building a view: tags

 

This chapter covers

  • Working with data tags
  • Controlling flow with control tags
  • Surveying the miscellaneous tags
  • Exploring the OGNL expression language

In this chapter, we’ll start looking at the Struts 2 tag library in detail. We’ll provide a good reference to the tags and clear examples of their usage. We’ll also finish exploring the Object-Graph Navigation Language (OGNL). We’ve already seen how OGNL is used to bind form fields to Java properties, such as those exposed on our action, to guide the framework’s automatic data transfer mechanism. In chapter 5 we learned about the type conversion aspects of OGNL in the context of data entering the framework.

Now, we’ll focus on the OGNL expression language (EL) in the context of data exiting the framework through the Struts 2 tag API. While the previous chapter showed us how to map incoming request parameters to Java properties exposed on the ValueStack, this chapter will show you how to pull data off of those properties for the rendering of result pages. We’ll explore the syntax of the OGNL EL and study the locations from which it can pull data. In particular, we’ll look closely at the ValueStack and the ActionContext. These objects hold all of the data important to processing a given request, including your action object. While it may be possible to blissfully ignore their existence during much of your development, we think the benefits are too high not to spend a few minutes getting to know them.

6.1. Getting started

 
 
 

6.2. An overview of Struts tags

 
 
 

6.3. Data tags

 
 
 

6.4. Control tags

 
 
 

6.5. Miscellaneous tags

 
 

6.6. Using JSTL and other native tags

 
 
 
 

6.7. A brief primer for the OGNL expression language

 

6.8. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest