Hi I have a 'mail in' application and display the emails waiting in the queue (line) on a 'wallboard'. I wish to refresh the display every x seconds using a partial refresh of the repeat containing the mail data. This works fine other than the I have a problem with a date field, which displays correctly until the first refresh, when it converts to the default 1 Jan 1970. I use the created date to calculate the no. of minutes the mail has been waiting - not shown here. Any help would be appreciated.
Many thanks
On the XPage I have:
<xp:scriptBlock
id="scriptBlockRefresh">
<xp:this.value>
<![CDATA[
setInterval(function() {
XSP.partialRefreshGet("#{id:mailInPanel}", {})
}, 5 * 1000)
]]>
</xp:this.value>
</xp:scriptBlock>
<xp:this.beforePageLoad><![CDATA[#{javascript:miniWallboardBean.loadOutstandingMailin();}]]></xp:this.beforePageLoad>
<xp:panel id="mailInPanel">
<xp:repeat id="repeat1" rows="30" value="#{miniWallboardBean.outstandingMailin}" var="rowData">
<xp:text escape="true" id="computedField1" value="#{rowData.from}"></xp:text>
<xp:text escape="true" id="computedField2" value="#{rowData.subject}"></xp:text>
<xp:text escape="true" id="computedField5" value="#{javascript:rowData.getCreatedDate().toJavaDate()}"></xp:text>
</xp:repeat>
</xp:panel>
In my Mailin Class
import lotus.domino.DateTime;
public class Mailin {
private String from;
private String subject;
private DateTime createdDate;
private String owner;
public String getFrom() {return from;}
public void setFrom(String from) {this.from = from;}
public String getSubject() {return subject;}
public void setSubject(String subject) {this.subject = subject;}
public DateTime getCreatedDate() {return createdDate;}
public void setCreatedDate(DateTime createdDate) {this.createdDate = createdDate;}
public String getOwner() {return owner;}
public void setOwner(String owner) {this.owner = owner;}
}
I get the data from view columns in my business logic:
public List <Mailin> getOutstandingMailin(){
ArrayList<Mailin> outstandingMailin = new ArrayList<Mailin>();
try {
ViewEntryCollection entries = NCLWallboardUtil.getAllEntries("Server","DB","View"); //Method to get a collection
if (entries !=null) {
ViewEntry entry = entries.getFirstEntry();
while (entry !=null){
Mailin mailin = loadMailInFromEntry(entry);
outstandingMailin.add(mailin);
ViewEntry oldEntry = entry;
entry = entries.getNextEntry(entry);
oldEntry.recycle();
}
entries.recycle();
}
} catch (NotesException e) {
e.printStackTrace();
}
return outstandingMailin;
}
private Mailin loadMailInFromEntry(ViewEntry entry) throws NotesException{
Mailin mailin = new Mailin();
mailin.setFrom((String) entry.getColumnValues().get(0));
mailin.setSubject((String) entry.getColumnValues().get(3));
mailin.setOwner((String) entry.getColumnValues().get(5));
mailin.setCreatedDate((DateTime) entry.getColumnValues().get(4));
return mailin;
}
In my session scope bean I have:
public class MiniWallboardBean implements Serializable{
private static final long serialVersionUID = 1L;
private List <Mailin> outstandingMailin;
private MiniWallboard miniWB;
public MiniWallboardBean(){
miniWB = new MiniWallboard();}
public void loadOutstandingMailin(){
try{
setOutstandingMailin(miniWB.getOutstandingMailin());
}catch (Exception e){
e.printStackTrace();
}
}
public void setOutstandingMailin(List <Mailin> outstandingMailil{
this.outstandingMailin = outstandingMailin;}
public List <Mailin> getOutstandingMailin() {
return outstandingMailin;}