开发者

Tapestry 5 Alert Dialog

开发者 https://www.devze.com 2023-04-02 20:46 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消