Sorry ... resend, I cant find the previous one in the mail archive and
I am not sure why the first one disappeared
-Corey
---------- Forwarded message ----------
From: Corey Scott <[EMAIL PROTECTED]>
Date: Thu, 18 Nov 2004 01:36:54 +0800
Subject: [Validation] and local string insertion
To: [EMAIL PROTECTED]
Hi,
I have been trying to achieve the same in my validate method to the
following extract from me validation.xml
<form name="UpdateTaskForm">
<field property="txtTaskSummary"
depends="required">
<msg
name="required"
key="stdError.missing"/>
<arg0 key="UpdateTaskForm.txtTaskSummary"/>
</field>
</form>
Extract from my message bundle:
stdError.required.field=Please enter/choose a {0}
UpdateTaskForm.txtTaskSummary=Task Summary
My validate method:
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
if ((this.txtTaskSummary == null)
|| (this.txtTaskSummary.length() == 0))
{
MessageResources resources = this.getServlet().getInternal();
errors.add(
"txtTaskSummary",
new ActionMessage(
"stdError.required.field",
resources.getMessage( request.getLocale(),
"UpdateTaskForm.txtTaskSummary")));
}
return errors;
}
Hopefully it is clear that I am trying get an output similar to:
Please enter/choose a Task Summary
But all I can get is:
Please enter/choose a {0} // without the whole get resources stuff
or
Please enter/choose a null //code above
I am getting the impression I am very much off track, any help would be great.
Thanks,
Corey
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]