We're updating the issue view to help you get more done. 

ValidationErrorReportResolution error with XHTML

Description

When you click on a link that causes a validation error, and don't have a sourcePage parameter in the query string, you'll get the nasty error returned on the ActionBeanContext#getSourcePageResolution method line 228.
The problem is that ValidationErrorReportResolution writes directly to the HttpServletResponse writer.
If you use a decoration framework like SiteMesh, you end up with malformed HTML (e.g. two <html> tag elements).

That along may not be that severe as long as you don't use XHTML and its draconian error handling, which will immediately cause your site to break.
Since mobile best practices dictate that mobile web applications should always use the content-type application/xhtml+xml, we need to implement our own ActionBeanContext and override the method getSourcePageResolution in each new mobile application we develop:

@Override
public Resolution getSourcePageResolution() {
if (getSourcePage() == null) {
throw new 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 '"
+ StripesConstants.URL_KEY_SOURCE_PAGE + "' 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().");
} else {
return new ForwardResolution(getSourcePage());
}
}

This really needs to be fixed in order to fully support XHTML.

Environment

None

Status

Assignee

BenB

Reporter

Samuel Santos

Labels

None

Tester

None

Components

Fix versions

Affects versions

Release 1.5.4

Priority

Major