1) add entity by method-binding
page 18
#{tipAction.add(tip)}
public void add(GolfTip tip) {
entityManager.persist(tip);
activeTip = tip;
facesMessages.add(
"Thanks for the tip, #{activeTip.author}!");
retrieveAllTips();
}
2) factory component trace
seam's factory component
which did not show in the log,
using following to record the in the log
log.info("Factory for tips called. Retrieving all golf tips...");
3) check empty content
if (tip.getContent().trim().length() == 0) { FacesMessages.instance().add("Please provide a tip from which we may all learn.");
return;
}
4) remove component
Contexts.removeFromAllContexts("tip");
// another option is to outject a null value to the context variable tip
5) find entity / remove entity
activeTip = entityManager.find(GolfTip.class, activeTip.getId());
entityManager.remove(activeTip);
6) display error
<div class="prop">
<h:outputLabel styleClass="name" for="author">Author <span class="required">*</span></h:outputLabel>
<span class="value">
<h:inputText id="author" value="#{tip.author}" required="true" style="width: 150px;"/>
</span>
<span class="error">
<h:graphicImage value="/img/error.gif" rendered="#{not empty [b]facesMessages.getCurrentMessagesForControl('author')[/b]}" styleClass="errors"/>
<h:message for="author" styleClass="errors"/>
</span>
</div>
7) set order of entityquery
pg 68
public String getOrder() {
if (super.getOrder() == null) {
setOrder("name asc");
}
return super.getOrder();
}
Seam's tips for Seam in Action (1)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Seam Order by
1) setOrder("Calendar.datesStart asc");2) http://seamframework.org/Communit
iteye_8138
2020-06-15 05:04:47
Seam 使用心得(二)接口實現
Java裏提倡使用面向接口編程以減弱組件之間的耦合,在上一篇裏已經定義了@Localpublic interface Register { publi
iteye_19333
2020-06-29 02:35:04
Jboss Seam
iteye_9409
2020-06-22 13:11:48
JSP中的
zhengdianwei
2020-06-21 13:43:43
Hibernate的MANUAL刷新模式
zhengdianwei
2020-06-21 13:43:42
JSF筆記
zhengdianwei
2020-02-25 18:52:06
錯誤解釋detached entity passed to persist
zhengdianwei
2020-02-25 18:52:06
JavaEye活動記實 Gavin King見面會以及Robbin Hibernate性能調優
yueguangyuan
2020-02-24 19:41:07
最便宜的高負載網站架構
iteye_14483
2020-02-24 15:57:30
(轉)共享我在項目中使用jsf的一些經驗
iteye_687
2020-02-24 06:46:09
[轉]Seam增強了JSF
iteye_6478
2020-02-23 19:18:58
開始接觸SEAM
iteye_6478
2020-02-23 19:18:58
seam體驗
iteye_6308
2020-02-23 11:31:09
seam中生成excel詳解
Y-F
2020-02-23 07:40:22
獲取Seam上下文組件(非@In方式)
iteye_4434
2020-02-22 12:01:55
24小時熱門文章