diff -r 3d16ad54b3dc -r 0a658e53177c src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Sat May 30 18:12:38 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java Mon Jun 01 14:46:58 2020 +0200 @@ -88,6 +88,7 @@ /** * Returns the name of the resource bundle associated with this servlet. + * * @return the resource bundle base name */ protected abstract String getResourceBundleName(); @@ -266,6 +267,17 @@ } /** + * Sets the view model object. + * The type must match the expected type in the JSP file. + * + * @param req the servlet request object + * @param viewModel the view model object + */ + public void setViewModel(HttpServletRequest req, Object viewModel) { + req.setAttribute(Constants.REQ_ATTR_VIEWMODEL, viewModel); + } + + /** * Obtains a request parameter of the specified type. * The specified type must have a single-argument constructor accepting a string to perform conversion. * The constructor of the specified type may throw an exception on conversion failures. @@ -281,7 +293,7 @@ final String[] paramValues = req.getParameterValues(name); int len = paramValues == null ? 0 : paramValues.length; final var array = (T) Array.newInstance(clazz.getComponentType(), len); - for (int i = 0 ; i < len ; i++) { + for (int i = 0; i < len; i++) { try { final Constructor ctor = clazz.getComponentType().getConstructor(String.class); Array.set(array, i, ctor.newInstance(paramValues[i]));