早上好,我正在将Fullcalender放在jsf网站上,我想使用数据库中的数据而不是静态数据,但是我尝试失败了
我执行了一个返回假日列表的函数,并且在万年历的情况下,我不知道如何放置startDate和endDate
`
import sys
reload(sys)
sys.setdefaultencoding('utf8')
@Override
public List<Holiday> Getholiday() {
Query query = em.createQuery("select p from Holiday p");
return query.getResultList();
}
@ManagedBean(name="lista")
@SessionScoped
public class AffichageHoliday implements Serializable {
@EJB
private HolidaysServiceLocal holocal ;
private Holiday holy ;
public String data = "1";
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
private List<Holiday> pls ;
@PostConstruct
public void init() {
pls= holocal.Getholiday();
}
public List<Holiday> doGetAllHolidays()
{
pls = holocal.Getholiday();
return pls;
}
public String loading(){
return "Editholiday.xhtml";
}
public String updateholidaymethode()
{
holocal.update(holy);
return "/AffichageHolidays.xhtml?faces-redirect=true";
}
public Holiday getHoly() {
return holy;
}
public void setHoly(Holiday holy) {
this.holy = holy;
}
public List<Holiday> getPls() {
return pls;
}
public void setPls(List<Holiday> pls) {
this.pls = pls;
}
@Entity
@Table(name="Holidays")
@NamedQuery(name="Holiday.findAll", query="SELECT h FROM Holiday h")
public class Holiday implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="HolidayId")
private int holidayId;
@Column(name="EndDate")
private Date endDate;
@Column(name="StartDate")
private Date startDate;
//bi-directional many-to-one association to User
@ManyToOne
@JoinColumn(name="ResourceIdFK")
private User user;
});