You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mufaddal Khumri <mk...@allegrocentral.com> on 2008/01/11 22:53:52 UTC

ActionErrors - is there a way to manually look them up ? ...

I am using ftl templates for the view and want to have access to the  
collection that has all the error messages in the view.

(<@s.actionerror/> just lists all the error messages one after the  
other.)

So, if i have a form like such:
<form>
	Email: <input type='textfield' name='email' value='${email?if_exists}'>
	<br>
	First Name: <input type='textfield' name='firstName' value='$ 
{firstName?if_exists}'>
	<br>
	Last Name: <input type='textfield' name='lastName' value='${lastName? 
if_exists}'>
</form>

Is there a way for me to get the error for the individual field  
manually in the ftl? i.e. by looking up some key in some context? for  
eg: ${email_errormessage}?


Thanks



Re: ActionErrors - is there a way to manually look them up ? ...

Posted by Mufaddal Khumri <mk...@allegrocentral.com>.
Okay that actually works , I had some problem else where that  
resulted in what I saw. So the solution to my original problem works  
if anybody needs it.

On Jan 11, 2008, at 4:06 PM, Mufaddal Khumri wrote:

> Apparently thats not working any pointers as to how i could get my  
> errors out manually:
>
> In my action I am doing: this.addFieldError("email", "Please enter  
> the email address.")
> and on my ftl: fieldErrors['key']?if_exists
>
> This is not working out , what am I missing.
>
> On Jan 11, 2008, at 3:38 PM, Mufaddal Khumri wrote:
>
>> Anyone who needs it:
>>
>> You can access ${fieldErrors['your-field-name']}
>>
>> -Mufaddal.
>> On Jan 11, 2008, at 2:53 PM, Mufaddal Khumri wrote:
>>
>>> I am using ftl templates for the view and want to have access to  
>>> the collection that has all the error messages in the view.
>>>
>>> (<@s.actionerror/> just lists all the error messages one after  
>>> the other.)
>>>
>>> So, if i have a form like such:
>>> <form>
>>> 	Email: <input type='textfield' name='email' value='${email? 
>>> if_exists}'>
>>> 	<br>
>>> 	First Name: <input type='textfield' name='firstName' value='$ 
>>> {firstName?if_exists}'>
>>> 	<br>
>>> 	Last Name: <input type='textfield' name='lastName' value='$ 
>>> {lastName?if_exists}'>
>>> </form>
>>>
>>> Is there a way for me to get the error for the individual field  
>>> manually in the ftl? i.e. by looking up some key in some context?  
>>> for eg: ${email_errormessage}?
>>>
>>>
>>> Thanks
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: ActionErrors - is there a way to manually look them up ? ...

Posted by Mufaddal Khumri <mk...@allegrocentral.com>.
Apparently thats not working any pointers as to how i could get my  
errors out manually:

In my action I am doing: this.addFieldError("email", "Please enter  
the email address.")
and on my ftl: fieldErrors['key']?if_exists

This is not working out , what am I missing.

On Jan 11, 2008, at 3:38 PM, Mufaddal Khumri wrote:

> Anyone who needs it:
>
> You can access ${fieldErrors['your-field-name']}
>
> -Mufaddal.
> On Jan 11, 2008, at 2:53 PM, Mufaddal Khumri wrote:
>
>> I am using ftl templates for the view and want to have access to  
>> the collection that has all the error messages in the view.
>>
>> (<@s.actionerror/> just lists all the error messages one after the  
>> other.)
>>
>> So, if i have a form like such:
>> <form>
>> 	Email: <input type='textfield' name='email' value='${email? 
>> if_exists}'>
>> 	<br>
>> 	First Name: <input type='textfield' name='firstName' value='$ 
>> {firstName?if_exists}'>
>> 	<br>
>> 	Last Name: <input type='textfield' name='lastName' value='$ 
>> {lastName?if_exists}'>
>> </form>
>>
>> Is there a way for me to get the error for the individual field  
>> manually in the ftl? i.e. by looking up some key in some context?  
>> for eg: ${email_errormessage}?
>>
>>
>> Thanks
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: ActionErrors - is there a way to manually look them up ? ...

Posted by Mufaddal Khumri <mk...@allegrocentral.com>.
Anyone who needs it:

You can access ${fieldErrors['your-field-name']}

-Mufaddal.
On Jan 11, 2008, at 2:53 PM, Mufaddal Khumri wrote:

> I am using ftl templates for the view and want to have access to  
> the collection that has all the error messages in the view.
>
> (<@s.actionerror/> just lists all the error messages one after the  
> other.)
>
> So, if i have a form like such:
> <form>
> 	Email: <input type='textfield' name='email' value='${email? 
> if_exists}'>
> 	<br>
> 	First Name: <input type='textfield' name='firstName' value='$ 
> {firstName?if_exists}'>
> 	<br>
> 	Last Name: <input type='textfield' name='lastName' value='$ 
> {lastName?if_exists}'>
> </form>
>
> Is there a way for me to get the error for the individual field  
> manually in the ftl? i.e. by looking up some key in some context?  
> for eg: ${email_errormessage}?
>
>
> Thanks
>
>


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