if (result.hasErrors()) {
return JSP_EDIT;
}
News news;
IJpaFactory<News> strategy = new NewsFactory(new J2eeConfig());
strategy.setTransactional(true);
try {
if (form.getId() == 0) {
news = new News();
} else {
news = strategy.get(form.getId());
}
news.setBrowseout(form.isBrowseout());
news.setContent(form.getContent());
news.setStamp(form.getStamp());
news.setTitle(form.getTitle());
news.setUrl(form.getUrl());
if (form.getId() == 0) {
strategy.add(news);
} else {
strategy.refresh(news);
}
} finally {
strategy.close();
}
return JSP_DISPLAY;
}