try {
EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(d2wContext().entity().name(), session());
epi.setNextPage(context().page());
nextPage = (WOComponent) epi;
} catch (IllegalArgumentException e) {
ErrorPageInterface epf = D2W.factory().errorPage(session());
epf.setMessage(e.toString());
epf.setNextPage(context().page());
nextPage = (WOComponent) epf;
}
return nextPage;
}