Chapter 12. Struts HTML Tags: Page Construction and Form Processing


IN THIS CHAPTER

  • Struts Tags, JSP Custom Tags, and Java Scriptlets: What's the Right Balance?

  • Using Struts HTML Tags to Render Basic HTML Elements

  • The Basics of Form Processing

  • Check Boxes and Radio Buttons

  • Drop Downs and Select/Option Lists

  • Input Validation and <html:errors>

  • Uploading a File Using <html:file>

  • Conclusions

This chapter is the first in a series of chapters examining the Struts tags. This first chapter examines the HTML custom tags. These tags are used in JSP files for generating HTML elements, coordinating form processing, and, in general, linking the JSP pages (View components ) into the rest of the Struts framework.

This chapter is focused on how to use the HTML tags. It isn't meant to be a reference for these tags. If you want a listing of every valid option for these tags, consult the Struts Web site or the documentation that came with the version of Struts you downloaded. (This documentation is located by default at /struts-documentation/index.html on the server where you installed Struts.)

However, if you want to know how to build Web pages using these tags, you've come to the right place. We wrote this chapter by first developing sample applications using the tags, and then providing screen shots and sample code for you to reuse. We felt this was the fastest way to get you up to speed.

A final note before we dive in. Many of the options relating to the Struts HTML tags have to do with specifying attributes that are simply passed through unchanged by Struts into the resulting HTML file that's sent to the client browser. For example, virtually every Struts HTML tag has an onclick attribute (and other similar on This or on That attributes) that enables you to specify a JavaScript event handler to be executed for that particular event type. We don't cover these attributes, nor other attributes that specifically relates to HTML and not Struts.

Note

For more information, please refer to another Sams title, such as Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days or Sams Teach Yourself HTML and XHTML in 24 Hours .

All the files referred to in this chapter are available in the StrutsTaglib.war Web application available on the companion CD-ROM. The sample applications for this chapter are pulled together and made accessible from a single JSP page in the StrutsTaglib Web application. This JSP page, shown in Figure 12.1, is located at the URL http://localhost:8080/StrutsTaglibs/html.jsp , assuming that you're using a default Tomcat installation.

Figure 12.1. The sample applications for Chapter 12.

graphics/12fig01.gif




Struts Kick Start
Struts Kick Start
ISBN: 0672324725
EAN: 2147483647
Year: 2002
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net