Hi,
I have a simple login form which captures a uname/passwd for authentication. No Spring Security being used (yet). The problem is when the authentication fails, an exception is raised which is caught by the controller and I save a error message w/ a token as follows -
Now accessing this "errors" List in my JSP is kindda driving me nuts, cos' it seems to be empty if i do this-Code:protected void saveErrors(HttpServletRequest request, String errorMsg) { List<String> errors = new ArrayList<String>(); errors.add(errorMesg); request.getSession().setAttribute("errors", errors); }
If I try to access (for testing purpose) the same as-Code:<c:if test="${not empty errors}"> //paint errors one by one </c:if>
...it works absolutely fine.Code:<%List<String> errors = (List<String>) request.getSession().getAttribute("errors");%> out.println(errors.get(0));
I'm not quiet sure what I'm missing here. I tried out the various "*Scope.errors" in case that was the problem, but in vain.
Is there a simpler way to return error messages & paint them in Spring MVC?
Any help is appreciated. Thanks in advance.


Reply With Quote
