John De Lello wrote:
I have JSP that uses the Html:Options tag to populate a DDLB. The action
Populate a what? :-)
class creates the collection and puts it in the Form. All works fine until
the form validation fails. When I come back from the form validation, I am
getting a "Bean define cannot assign to a null value" error.
I know this is because the action class is never reached if validation
fails, so I'm wondering how I can preserve the collection in the form in
that case. Do I need to re-populate the collection in the validate method if
a failure occurs? I was trying to keep all that logic in the action class
only. I can't put the collection in Session because for other reasons that I
don't control.
It sounds like the 'input' attribute on your action mapping is pointing
directly at the JSP that generates the form. If you need to pre-populate
data before rendering the JSP, you should have the 'input' attribute
point to the appropriate action mapping instead. If validation fails,
Struts will then invoke the action which can initialize your collection
before forwarding to the JSP.
Without seeing what your existing code and configuration looks like it's
hard to be more specific than that, so if that doesn't give you enough
to solve the problem, try posting the relevant sections of your
struts-config.xml and action class with a description of what you tried.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]