1

I added time in the jsf, but the time stored is always time value that i input + 7 hours, how do I make the time stored in the database match the time that I input?

Here is my Create.xhtml code

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:f="http://xmlns.jcp.org/jsf/core"
  xmlns:p="http://primefaces.org/ui"
  xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<div class="form-row">
            <div class="col-md-6 form-group">
                <label class="text-black-50">Jam Pertama</label>
                <h:inputText class="form-control" id="jam1" a:type="time" value="#{pendaftaranController.selected.jam1}" title="#{bundle.CreatePendaftaranTitle_jam1}">
                 <f:convertDateTime pattern="HH:mm"/>
                </h:inputText>
            </div>
          </div>
          <div class="form-row">
            <div class="col-md-6 form-group">
                <label class="text-black-50">Jam Kedua</label>
                <h:inputText class="form-control" id="jam2" a:type="time" value="#{pendaftaranController.selected.jam2}" title="#{bundle.CreatePendaftaranTitle_jam2}" >
                    <f:convertDateTime pattern="HH:mm"/>
                </h:inputText>
            </div>
          </div>

Here is my model code

 @Column(name = "Jam1")
@Temporal(TemporalType.TIME)
private Date jam1;

@Column(name = "Jam2")
@Temporal(TemporalType.TIME)
private Date jam2;
 public String getHari1() {
    return hari1;
}

public void setHari1(String hari1) {
    this.hari1 = hari1;
}

public String getHari2() {
    return hari2;
}

public void setHari2(String hari2) {
    this.hari2 = hari2;
}
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
newbie3
  • 93
  • 6

0 Answers0