0
爲什麼在偵聽器方法執行後調用onstart? 在偵聽器方法執行之前,我應該怎樣調用onstart方法? 使用jsf 2.1和primefaces 4.0。在偵聽器方法執行後調用Onstart
<p:ajax event="eventMove" listener="#{myBean.onEventMove}"
update="mygrwlmsg" onstart="setLStorageDateToBean();"
oncomplete="if(args.facesMessagesAvailable){handleEditEventRequest(args.eventList);scheduleWidget.update();}" />
通過remoteCommand
調用bean方法function setLStorageDateToBean()
{
if(typeof(Storage)!=='undefined')
{
if((localStorage.startDate || localStorage.getItem('startDate') != null)
&& (localStorage.endDate || localStorage.getItem('endDate') != null))
{
var sDate = parseInt((localStorage.startDate)/1000);
var eDate = parseInt((localStorage.endDate)/1000);
var lCalRefresh = parseInt((localStorage.lastCalRefresh)/1000);
setLocalStorageDate([{name:'startDate',value:sDate},{name:'endDate',value:eDate},{name:'lastCalRefresh',value:lCalRefresh}]);
}
}
}
<p:remoteCommand name="setLocalStorageDate" actionListener="#{myBean.setDateFromLocaStorage}" >
</p:remoteCommand>
bean方法
public void setDateFromLocaStorage()
{
int startDate = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("startDate"));
int endDate = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("endDate"));
int lCalRefresh = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("lastCalRefresh"));
setlStorStartDate(startDate);
setlStorEndDate(endDate);
setlStorLastRefresh(lCalRefresh);
}
什麼在setLStorageDateToBean()方法? – 2014-10-06 05:07:51