abhi
abhi

Reputation: 1614

type time in hh:mm format in jsf

The date format contains dd/mm/yyyy hh:mm:ss which can be used in this manner using <rich:calendar datePattern="dd/MM/yyyy HH:mm"
value="#{uCBController.uCBUnit2.ucbEsp.lastSD}"
button. but this gives option to modify only date (and may be along with time.)

But what I want is when select this button , it should display only time to select and modify, and saves in time format only.

Upvotes: 0

Views: 3166

Answers (1)

Konstantin Yovkov
Konstantin Yovkov

Reputation: 62864

Create two <rich:inputNumberSlider> components (one for picking the hours and one for picking the minutes). <rich:calendar> doesn't support picking only the time.

<rich:inputNumberSpinner value="#{bean.hours}" minValue="0" maxValue="23" />
<rich:inputNumberSpinner value="#{bean.minutes}" minValue="0" maxValue="59" />

Then, in the managed bean, just create two properties with the correspoding accessors.

public class Bean {
  private Integer hours;

  private Integer minutes;

  //getters, setters
}

Upvotes: 2

Related Questions