3
后我有一个命令链接:显示警报()执行管理的bean的操作方法
<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;
}
正如评论所指出的,我d喜欢显示alert()
最终用户无法删除该项目。我怎样才能做到这一点?