Tapestry 5 Alert Dialog
How can we show an alert dialog for validation like the alert dialog in 开发者_开发问答tapestry 4?
Do you mean the Errors component, which renders a summary of all validation messages?
In tapestry you can use AlertManager to show the alert Dailog. For example
public class Contact {
@Property
private Info info;
@Inject
private Session session;
@Inject
private AlertManager alertManager;
@InjectComponent
private Zone clickZone;
@Property
@Persist
private int clickCount;
@CommitAfter
public void onSuccess() {
session.persist(info);
}
public void onActionFromIncrement() {
clickCount++;
alertManager.info("increment clicked"); // here you can see how alertManager is working.
}
Object onActionFromIncrementByAjay() {
clickCount++;
alertManager.info("ajax call");
return clickZone;
}
}
you don't need to add anything in your tml files. You just import and use the info method of alertManager and show the alert dailog as you want.
精彩评论