On Wed, Apr 13, 2011 at 10:05 AM, Eric Lentz wrote:
> The real application is not a SSCCE, but exhibits the same symptoms.

Okay.

To make sure I have this correctly reasoned (and have read previous
emails correctly).

Q1: Which path(s) through the app are you saying are a bug?

You said:

> If I add a validation file, validating anything, not even specifically the
> list, the page fails telling me that the list "could not be resolved as a
> collection/array/map/enumeration/iterator type. Example: people or
> people.{name}"

Are you saying that the validation fails even if you've entered all
data correctly (as far as you're concerned)?

If "yes": the observed behavior is correct, for the reasons I've given.
If "no": the observed behavior is correct, for the reasons I've given.

See below for my walkthrough of the submission process.

Q2: Basic framework knowledge?

You said:

> The failure occurs before the action is even reached. If I extend
> ActionSupport and override validate() and populate the list, then the page
> works again.

The action method ("add" in this case) will *not* be called if there
is a type conversion or validation error--are you aware of that? A few
interceptors work together to determine there are validation errors
and short-circuit the request process.

If the action method ("add" in this case) *is* called (no type
conversion/validation errors) you're forwarding to a JSP page that
also expects the list to be present, and you have not prepared the
list.

Could you list briefly the exact sequence of events you believe is happening?

Mine looks like this:

1) User lands on form page "/list.action". List populated by list() method.
2) User fills out form (Q: with or without validation errors?) and
submits to "/register.action".
3) Type conversion happens (errors added to list)
4) Validation happens (errors added to list)
5) Workflow interceptor checks for errors:
5a) hasErrors: returns "input"; register-error.jsp rendered (since no
list, JSP shows error)
5b) noErrors: returns SUCCESS; register.jsp rendered (since no list,
JSP shows error)

Do you understand why I don't believe you're seeing is a bug? You're
forwarding to the register.jsp page, which expects the list to be
populated, and it isn't.

By doing so you circumvent the normal S2 mechanism for initializing
request-level attributes, Preparable.prepare().

This way also introduces a page-refresh issue: after submission if the
user refreshes the page the form will be submitted again.

Most apps would use a "redirectAction" result, redirecting to the
"list" action. (If user refreshes there it's just a refresh of the
"list" action.)

Preparable exists precisely to eliminate the original issue, and
"redirectAction" implements the Post-Redirect-Get pattern.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to