Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Custom Components > Decoding: Processing Request Values - Pg. 427

Decoding: Processing Request Values 427 javax.faces.context.ResponseWriter · void startElement(String elementName, UIComponent component) Writes the start tag for the specified element. The component parameter lets tools associate a component and its markup. Currently, the JSF reference implementation ignores this attribute. · · void endElement(String elementName) Writes the end tag for the specified element. void writeAttribute(String attributeName, String attributeValue, String componentProperty) Writes an attribute and its value. This method can only be called between calls to startElement() and endElement() . The componentProperty is the name of the component property that corresponds to the attribute. This parameter is intended for tools and is not used by the JSF reference implementation. Decoding: Processing Request Values To understand the decoding process, keep in mind how a web application works. The server sends an HTML form to the browser. When the user submits the form, the browser sends back a POST request that consists of name/value pairs. That POST request is the only data that the server can use to interpret the user 's actions inside the browser. If the user clicks the increment or decrement button, the ensuing POST request includes the names and values of all text fields, but only the name and value of the clicked button. For example, if the user clicks the month spinner 's increment button in the application shown in Figure 11­1 on page 420, the following request parameters are transferred to the server from the browser: Name _id1:monthSpinner _id1:yearSpinner _id1:monthSpinner.more Value 1 2010 > When our spinner decodes an HTTP request, it looks for the request parameter names that match its client ID and processes the associated values. The spin- ner 's decode method is listed next.