zwwcn

Just another WordPress.com site

Monthly Archives: December 2012

check whether a request is ajax request

public static boolean isAjax(request) {
return “XMLHttpRequest”.equals(request.getHeader(“X-Requested-With”));
}

 

Advertisements

seam code to show current conversations

<h:dataTable value=”#{conversationList}”
var=”entry”>
<h:column>
<h:commandLink action=”#{entry.select}”
value=”#{entry.description}”/>
<h:outputText value=”[current]”
rendered=”#{entry.current}”/>
</h:column>
<h:column>
<h:outputText
value=”#{entry.id}  ”/>
</h:column>
<h:column>
<h:outputText value=”#{entry.startDatetime}”>
<f:convertDateTime type=”time”
pattern=”hh:mm”/>
</h:outputText>
</h:column>
</h:dataTable>

set last modified for entity in jpa

we can only do it in @entity in JPA.

@PrePersist
@PreUpdate
private void setModifiedFields() {
setModifiedBy(String.valueOf(getCurrentUserObjID()));
setModifiedDate(DateTimeUtil.getCurrentDate());
}