Hi Ben,

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, you must always implement
your own ActionBeanContext and override the method getSourcePageResolution.
In my case I ended up with this implementation:
@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());
    }
}

It would be really nice to have this fixed on the next Stripes release.
Is there any quick fix that comes to your minds?
Should I create a JIRA bug?

Cheers,

--
Samuel Santos
http://www.samaxes.com/
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to