【发布时间】:2015-05-18 17:16:35
【问题描述】:
我有一个命令链接:
<h:commandLink value="Delete"
onclick="return confirm('Are you sure?');"
action="#{bean.deleteDestination(destination, '/destination/show')}" />
它调用这个托管的 bean 操作方法:
public String deleteDestination(Destination selected, String action) {
List<Flight> flights = getEjbFlightFacade().findFlightWithDestination(selected);
if (flights.isEmpty()) {
getEjbDestinationFacade().remove(selected);
setDestinations(getEjbDestinationFacade().findAll());
}
else {
// Here need to show an alert() that user can't remove the item.
}
return action;
}
如评论所示,我想显示最终用户无法删除该项目的alert()。我怎样才能做到这一点?
【问题讨论】: