HTML and CSS Reference
In-Depth Information
The
selectOneMenu
component renders a combo-box with a list of beverage items (
Tea
,
Coffee
,
Coca-Cola
);
when the user selects one of the available beverages, the form is submitted and the
valueChangeListener
method
(the
beverageSelected
method of the
Beverage
managed bean) is executed to calculate the price of the selected
beverage. You may notice that using the
rendered
attribute, the
outputText
will not be rendered if the beverage price
is not available.
■
ne
stands for (not equal), it is also equivalent to
!=
which is supported by eL. eL also supports the following
relational operators:
Note
1.
eq
stands for (equal) and it is equivalent to
==
.
2.
lt
stands for (less than) and it is equivalent to
<
.
3.
le
stands for (less than or equal) and it is equivalent to
<=.
4.
gt
stands for (greater than) and it is equivalent to
>
.
5.
ge
stands for (greater than or equal) and it is equivalent to
>=
.
Listing 2-22 shows the
Beverage
managed bean.
Listing 2-22.
The Beverage Managed Bean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ValueChangeEvent;
@ManagedBean
@RequestScoped
public class Beverage {
private String name;
private Double price;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
