HTML and CSS Reference
In-Depth Information
Now, let's see how to use LocationConverter in the JSF application. Listing 3-8 shows TestBean managed bean
which includes a Location attribute ( location ).
Listing 3-8. TestBean Managed Bean Class
package com.jsfprohtml5.example.model;
import java.io.Serializable;
import java.util.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class TestBean implements Serializable {
// ...
private Location location;
// ...
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
// ...
public String proceed() {
return null;
}
}
Listing 3-9 shows the LocationConverter converter XHTML test page.
Listing 3-9. LocationConverter XHTML Test Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns=" http://www.w3.org/1999/xhtml "
xmlns:h=" http://java.sun.com/jsf/html "
xmlns:f=" http://java.sun.com/jsf/core " >
<h:head>
<title>Location Converter Test</title>
</h:head>
<h:body>
<h:form>
<h1>Converter Test</h1>
<h:outputText value="Enter location: "/>
<h:inputText id="location"
value="#{testBean.location}"
required="true">
<f:converter converterId="com.jsfprohtml5.LocationConverter" />
</h:inputText>
 
Search WWH ::




Custom Search