2011-09-07 168 views

回答

0

您的意思是Errors component,它呈现所有验证消息的摘要?

+0

不,不是错误组件。这就像一个包含窗体中所有错误验证的对话框。它不会向服务器发送请求。因为所有的验证都在客户端进行。像这样一个http://tapestry.apache.org/tapestry4.1/javascript/form-validation.html – nathan21

+0

@Nathan:这已被内嵌验证通知取代,它在出现的地方显示错误(红色标签,弹出泡泡)。 T5中不存在这种警报对话框。 – Henning

+0

好的,谢谢Henning – nathan21

0

在tapestry中,您可以使用AlertManager来显示警报Dailog。例如

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; 
    } 
} 

你不需要在你的tml文件中添加任何东西。您只需导入并使用alertManager的info方法,并根据需要显示alert dailog。