try
{
ModelRequestWrapper wrappedRequest = new ModelRequestWrapper(request);
ModelResponseWrapper wrappedResponse = new ModelResponseWrapper(response);
EditFormContext context = new EditFormContext();
context.setRequest(wrappedRequest);
readConfig();
Object id = handler.getPersistentId(wrappedRequest, contextId, keyName);
if (StringTools.isTrimEmpty(id) || request.hasParameter("new"))
{
id = new Integer(- 1);
}
context.setId(id);
String persistentsId = FormTools.createContextKey(contextId, id);
FormularDescriptor formular = createFormular(wrappedRequest);
if (request.getParameter("page") != null)
{
formular.setPage(NumberTools.toInt(request.getParameter("page"), formular.getPage()));
}
if (NumberTools.toBool(request.getParameter("AKTERA_auto"), false)
&& request.getParameter("AKTERA_page") != null)
{
formular.setPage(NumberTools.toInt(request.getParameter("AKTERA_page"), formular.getPage()));
}
handler.prepareFormular(wrappedRequest, wrappedResponse, formular);
PersistentDescriptor persistents = formular.getPersistents();
context.setPersistents(persistents);
if (persistents == null
|| (request.getParameter("error") == null && request.getParameter("reedit") == null && ! reeditAlways))
{
persistents = new PersistentDescriptor(persistentsId);
context.setPersistents(persistents);
for (Configuration configuration : attributeConfig)
{
String name = configuration.getAttribute("name");
Object value = null;
try
{
value = context.evalExpressionLanguageValue(configuration.getAttribute("value"));
if (value != null)
{
persistents.putAttribute(name, value);
}
}