struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Brautaset Aronsen (JIRA)" <>
Subject [jira] Commented: (WW-3069) Migration from 2.0.x to 2.1.x: fieldError does not use the full parameter name as id
Date Wed, 01 Apr 2009 08:47:02 GMT


Henrik Brautaset Aronsen commented on WW-3069:

To elaborate further: How will the template / fieldError cope with MyAction.getForm().getEmail()
vs. MyAction.getEmail() if they both are referred to as <s:fielderror fieldName="email"

> Migration from 2.0.x to 2.1.x: fieldError does not use the full parameter name as id
> ------------------------------------------------------------------------------------
>                 Key: WW-3069
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.6
>            Reporter: Henrik Brautaset Aronsen
> After upgrading from Struts 2.0.11 to 2.1.6, fieldErrors weren't displayed next to form
fields any more.   The validation still worked, because I could still see the errors by issuing
a <s:fielderror/>.
> My form is a value on the action, and is addressed like this:
>    <s:textfield label="Your e-mail address" name="" theme="mytheme" />
> I noticed that to access a separate value in fieldError in 2.1.6, I had to chop off "form.":
>    <s:fielderror fieldName="" /> <!-- doesn't show anything -->
>    <s:fielderror fieldName="email" /> <!-- shows the error-->
> Now, to be able to show my error using my template, I had to add an ID to my textfield:
>    <s:textfield label="Your e-mail address" id="email" name="" theme="mytheme"
> Then I had to change the default hasErrorField assignment in the controlheader.tpl template:
>    <#assign hasFieldErrors = && fieldErrors?? &&
fieldErrors[]??/>  <!-- does not work -->
>    <#assign hasFieldErrors = && fieldErrors?? && fieldErrors[]??/>
 <!-- works as intended -->
> And change way I fetched errors in my controlfooter.tpl:
>    <#list fieldErrors[] as error> <!-- does not work -->
>    <#list fieldErrors[] as error> <!-- works -->
> Voila!  I can see field errors again.
> Just to summarize:  To access a fieldError, I have to manually strip "form."from "".
 I also have to set an additional ID on my form fields (with the stripped value) to be able
to access it from my template.  Is this the intended behaviour?

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message