ActionForm actionForm,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
RollerRequest rreq = RollerRequest.getRollerRequest(request);
RollerSession rses = RollerSession.getRollerSession(request);
BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
BookmarkFormEx form = (BookmarkFormEx)actionForm;
FolderData parentFolder = null;
if (null!=rreq.getBookmark() && null==request.getParameter("correct"))
{
// If request specifies bookmark and we are not correcting an
// already submitted form then load that bookmark into the form.
BookmarkData bd = rreq.getBookmark();
form.copyFrom(bd, request.getLocale());
request.setAttribute("state","edit");
// Pass bookmark's Folder on as attribute.
parentFolder = bd.getFolder();
BasePageModel pageModel = new BasePageModel(
"bookmarkForm.edit.title", request, response, mapping);
pageModel.setWebsite(parentFolder.getWebsite());
request.setAttribute("model", pageModel);
}
else if (null != request.getParameter("correct"))
{
// We are correcting a previously submtted form.
request.setAttribute("state","correcting");
// Folder is specified by request param, pass it on as attribute.
parentFolder = rreq.getFolder();
BasePageModel pageModel = new BasePageModel(
"bookmarkForm.correct.title", request, response, mapping);
pageModel.setWebsite(parentFolder.getWebsite());
request.setAttribute("model", pageModel);
}
else
{
// We are adding a new bookmark
request.setAttribute("state","add");
// Folder is specified by request param, pass it on as attribute.
parentFolder = rreq.getFolder();
BasePageModel pageModel = new BasePageModel(
"bookmarkForm.add.title", request, response, mapping);
pageModel.setWebsite(parentFolder.getWebsite());
request.setAttribute("model", pageModel);
}