if (description == null) {
description = "";
}
DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.FactoryType.JDBC);
PageDAO pageDAO = (PageDAO) daoFactory.getDAO(Page.class);
Page page = null;
if (idSt != null) {
int id = Integer.parseInt(idSt);
page = new Page(id, name, description, json);
pageDAO.updateJson(page);
} else {
page = new Page(name, description, json);
int id = pageDAO.saveAndGetId(page);
page.setId(id);
}
out.write(XMLFormatter.toXML(page));
} catch (NumberFormatException nbe) {
Logger.getLogger(PageController.class.getName()).log(Level.SEVERE, null, nbe);