import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.Outputable;
import org.cacert.gigi.output.template.Template;
-import org.cacert.gigi.pages.Page;
public class DomainAddForm extends Form {
}
@Override
- public boolean submit(PrintWriter out, HttpServletRequest req) {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
try {
String parameter = req.getParameter("newdomain");
if (parameter.trim().isEmpty()) {
throw new GigiApiException("No domain inserted.");
}
- Domain d = new Domain(target, parameter);
+ Domain d = new Domain(target, target, parameter);
pcf.setTarget(d);
- pcf.submit(out, req);
- return true;
+ pcf.submit(req);
+ return new RedirectResult(DomainOverview.PATH);
} catch (NumberFormatException e) {
- new GigiApiException("A number could not be parsed").format(out, Page.getLanguage(req));
- return false;
- } catch (GigiApiException e) {
- e.format(out, Page.getLanguage(req));
- return false;
+ throw new GigiApiException("A number could not be parsed");
}
}