Monday, April 18, 2011

Stripes ValidationErrorReportResolution with IllegalStateException


[ValidationErrorReportResolution] (qtp700486981-53:)
java.lang.IllegalStateException: Here's how it is. Someone (quite possibly the Stripes Dispatcher) needed to get the source page resolution. But no source page was supplied in the request, and unless you override ActionBeanContext.getSourcePageResolution() you're going to need that value. When you use a <stripes:form> tag a hidden field called '_sourcePage' is included. If you write your own forms or links that could generate validation errors, you must include a value  for this parameter. This can be done by calling request.getServletPath().

The Why:
It was seen that some URLs(action beans) with malformed  parameters were being set as src attrib of img tags
eg: /Hello.action?getUserImage&userId='{userId}'
where actual URL should be some like  /Hello.action?getUserImage&userId=5001

What worked for me:
The construction HTML for the creating the img tags had outer single-quotes and inner double quotes like:
innerHtml ='<img src="/Hello.action?getUserImage&userId=' + userId
+ ' " rel="${contextPath}/" width="87" height="54" alt="' + userName
+'" title="'+userName+'" />' +
'<span></span>'

It should have double quotes outside like:
innerHtml ="<img src='/Hello.action?getUserImage&userId=" + userId + " ' "


No comments:

Post a Comment