You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Blessing, Jeffrey" <bl...@msoe.edu> on 2001/10/02 22:08:06 UTC
Re: validate() fails to re-populate the html:form
Just a follow-up to describe how I fixed the problem below:
===========================================
"Blessing, Jeffrey" wrote:
>
> I've just recently read the entire thread on this issue posted
> last Wed 9/19/01 and still have the following problem:
>
> When the validate() method of my form bean returns a non-
> empty ActionErrors list, struts fails to re-populate the form
> fields with the text that was submitted successfully. I've
> checked the following:
>
> In ApplicationResources.properties:
> ========================
> errors.header=<ul>
> errors.footer=</ul><hr>
>
> In struts-config:
> ==========
> <action path="/saveTriage"
> type="org.apache.struts.webapp.example.SaveTriageAction"
> name="triageForm"
> scope="request"
> input="/triage.jsp"
> validate="true">
> </action>
>
> The errors list *is* reported successfully on the input JSP page, however.
> This is the only JSP page involved (no wizard like series of JSP pages).
> I tried the fix suggested in the list, of changing the scope to "session",
> and
> the app throws the following exception:
> "No bean found under attribute key triageForm"
>
> I've based this app on the struts-example app, as it appears that everyone
> else is also doing.
>
> What next?!
===========================================
The problem is that, when the name=... and type=... attributes are specified
on a
<html:form ...> tag, the form bean is created anew every time the page is
visited,
thus losing the field data from the submit action. I got down this path by
reading
about the from tag and thought it was making things clearer to struts. When
I
removed the name and type attributes, the form fields were repopulated
properly
by struts.
Jeff
===========================================
Dr. Jeffrey Blessing
Associate Professor
Electrical Engineering & Computer Science Dept.
Milwaukee School of Engineering
1025 North Broadway
Milwaukee, Wisconsin 53202-3109
===========================================
email: blessing@msoe.edu <ma...@msoe.edu>
web: www.msoe.edu/~blessing <http://www.msoe.edu/~blessing>
phone: (414) 277-7194
fax: (414) 277-7497
===========================================