Re: html:errors tag implementation

2001-09-26 Thread David Winterfeldt

The string you pass into ActionError must be a key
from your message resource property file.  Otherwise
the property for error messages is just a key to look
up messages and the convention is to make it match the
property name.

html:errors name=fooBean property=bar.foo[3].xyz

errors.add (bar.foo[3].xyz, 
   new ActionErrorError (error.required);

error.required=The field is required.


This is more of user list question than a dev list one
so I've copied the user list.

David

--- Henry Mugasha [EMAIL PROTECTED] wrote:
 Hi All,
 
 Does the current stable struts release support
 assigning errors to
 nested indexed propertys of ActionForms?
 
 
 For example,
 I have an ActionForm called fooBean with the
 property bar that is a class with a reference to the
 collection whose reference is foo and each item in
 the collection has a property xyz.
 
 I want to access the errors assigned to this
 property (by the validate method of the fooBean
 ActionForm) like so:
 
  html:errors name=fooBean
 property=bar.foo[3].xyz
 
 
 If this feature is supported, how does one set the
 ActionError?
 
 I tried 
 
 ...
 ActionErrors errors = new ActionErrors();
 ...
 errors.add (bar.foo[3].xyz, 
  new ActionErrorError (  error string 
 );
 
 
 but this failed to show any error messages.
 
 The point of this is to show error messages against
 each form field
 in stead of showing all error messages at the top of
 form with
 html:errors/.
 
 Any help,suggestions,ideas are highly appreciated.
 
 Thanks
 
 Henry
 
 
 Make a difference, help support the relief efforts
 in the U.S.
 http://clubs.lycos.com/live/events/september11.asp


__
Do You Yahoo!?
Get email alerts  NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com



RE: html:errors/ tag

2001-05-23 Thread Muthu Kannappan

Hi
I have written a subclass of org.apache.struts.util.MessageResources  and also
a subclass of org.apache.struts.util.MessageResourcesFactory,
and made my implementation so that when html:errors/ tag is called it gets
the error message from my database instead of the ActionResources.properties
file.

But the problem that I have got now is, How do I set that up in Struts and
which XML file or other file have I to modify.
Could you please help me out in this.

Thanks
Kanna




 
You can subclass org.apache.struts.util.MessageResources to provide your own
database implementation of a resource bundle (as opposed to the common
properties implementation via
org.apache.struts.util.PropertyMessageResources), put an instance of your
subclass in a servlet context (application-scope) attribute, and then use
the html:errors tag's bundle attribute to specify the name you gave to
the servlet context (application-scope) attribute.

At least that should be the theory behind it, though I have not done it
myself.

-- Stoehr

P.S.  You could also have the application resource bundle be an instance of
your MessageResources subclass by creating a subclass of
org.apache.struts.util.MessageResourcesFactory that creates instances of
your MessageResources subclass, and then specify the new factory in the
ActionServlet's factory init parameter.


-Original Message-
From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 03:52 AM
To: '[EMAIL PROTECTED]'
Subject: RE: html:errors/ tag


Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42


To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna



Get free email and a permanent address at http://www.netaddress.com/?N=1



RE: html:errors/ tag

2001-05-23 Thread Sukachevin, Stoehr

Sounds like you want the application resource bundle to be an instance of
your MessageResource subclass.  In that case, you should just have to
specify your MessageResourcesFactory subclass fully qualified name for the
factory init parameter of the ActionServlet (see
http://jakarta.apache.org/struts/userGuide/building_controller.html#dd_confi
g_servlet).


-- Stoehr


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 07:13 PM
To: [EMAIL PROTECTED]
Subject: RE: html:errors/ tag


Hi
I have written a subclass of org.apache.struts.util.MessageResources  and
also
a subclass of org.apache.struts.util.MessageResourcesFactory,
and made my implementation so that when html:errors/ tag is called it gets
the error message from my database instead of the ActionResources.properties
file.

But the problem that I have got now is, How do I set that up in Struts and
which XML file or other file have I to modify.
Could you please help me out in this.

Thanks
Kanna




 
You can subclass org.apache.struts.util.MessageResources to provide your own
database implementation of a resource bundle (as opposed to the common
properties implementation via
org.apache.struts.util.PropertyMessageResources), put an instance of your
subclass in a servlet context (application-scope) attribute, and then use
the html:errors tag's bundle attribute to specify the name you gave to
the servlet context (application-scope) attribute.

At least that should be the theory behind it, though I have not done it
myself.

-- Stoehr

P.S.  You could also have the application resource bundle be an instance of
your MessageResources subclass by creating a subclass of
org.apache.struts.util.MessageResourcesFactory that creates instances of
your MessageResources subclass, and then specify the new factory in the
ActionServlet's factory init parameter.


-Original Message-
From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 03:52 AM
To: '[EMAIL PROTECTED]'
Subject: RE: html:errors/ tag


Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42


To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna



Get free email and a permanent address at http://www.netaddress.com/?N=1



RE: html:errors/ tag

2001-05-23 Thread Niall Pemberton

I haven't done this, but if you look in the comments at the start of
ActionServlet it say you need to add a factory parameter to the web.xml
file, something like this:

  servlet
servlet-nameaction/servlet-name
servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameapplication/param-name
  param-valuemyApp.ApplicationResources/param-value
/init-param
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
  param-namefactory/param-name
  param-valuemyPackage.myMessageResourcesFactory/param-value
/init-param
load-on-startup2/load-on-startup
  /servlet

Niall

 -Original Message-
 From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
 Sent: 24 May 2001 00:13
 To: [EMAIL PROTECTED]
 Subject: RE: html:errors/ tag


 Hi
 I have written a subclass of
 org.apache.struts.util.MessageResources  and also
 a subclass of org.apache.struts.util.MessageResourcesFactory,
 and made my implementation so that when html:errors/ tag is
 called it gets
 the error message from my database instead of the
 ActionResources.properties
 file.

 But the problem that I have got now is, How do I set that up in Struts and
 which XML file or other file have I to modify.
 Could you please help me out in this.

 Thanks
 Kanna





 You can subclass org.apache.struts.util.MessageResources to
 provide your own
 database implementation of a resource bundle (as opposed to the common
 properties implementation via
 org.apache.struts.util.PropertyMessageResources), put an instance of your
 subclass in a servlet context (application-scope) attribute, and then use
 the html:errors tag's bundle attribute to specify the name you gave to
 the servlet context (application-scope) attribute.

 At least that should be the theory behind it, though I have not done it
 myself.

 -- Stoehr

 P.S.  You could also have the application resource bundle be an
 instance of
 your MessageResources subclass by creating a subclass of
 org.apache.struts.util.MessageResourcesFactory that creates instances of
 your MessageResources subclass, and then specify the new factory in the
 ActionServlet's factory init parameter.


 -Original Message-
 From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 22, 2001 03:52 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: html:errors/ tag


 Hi Kanna

 please send me the answer if u find it.

 thanks

 Sudarshan

  tks
 
  Sudarshan
  Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
  Email:  [EMAIL PROTECTED]


 -Original Message-
 From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 23 May 2001 8:42


 To: [EMAIL PROTECTED]
 Subject: html:errors/ tag


 Hi
 I have been trying to use struts and wanted to use the html:errors/ tag.
 I wanted to the error messages to be read from a database instead of the
 ActionResources properties file. Could you let me know
 what exactly I am suppose to do to achive that.
 I wanted to changed the code at the place where it was looking for the
 properties files and make it look into the database.
 Could any one suggest me how to do that or has anybody done that already.

 Thanks
 Kanna


 
 Get free email and a permanent address at http://www.netaddress.com/?N=1





RE: html:errors/ tag

2001-05-22 Thread SESHADRI Sudarshan

Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42
To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna


Get free email and a permanent address at http://www.netaddress.com/?N=1


IMPORTANT NOTICE:
This e-mail and any attachment to it is intended only to be read or used by
the named addressee.  It is confidential and may contain legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistaken transmission to you.  If you receive this e-mail in error, please
immediately delete it from your system and notify the sender.  You must not
disclose, copy or use any part of this e-mail if you are not the intended
recipient.  The RTA is not responsible for any unauthorised alterations to
this e-mail or attachment to it.  



RE: html:errors/ tag

2001-05-22 Thread Sukachevin, Stoehr

You can subclass org.apache.struts.util.MessageResources to provide your own
database implementation of a resource bundle (as opposed to the common
properties implementation via
org.apache.struts.util.PropertyMessageResources), put an instance of your
subclass in a servlet context (application-scope) attribute, and then use
the html:errors tag's bundle attribute to specify the name you gave to
the servlet context (application-scope) attribute.

At least that should be the theory behind it, though I have not done it
myself.

-- Stoehr

P.S.  You could also have the application resource bundle be an instance of
your MessageResources subclass by creating a subclass of
org.apache.struts.util.MessageResourcesFactory that creates instances of
your MessageResources subclass, and then specify the new factory in the
ActionServlet's factory init parameter.


-Original Message-
From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 03:52 AM
To: '[EMAIL PROTECTED]'
Subject: RE: html:errors/ tag


Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42
To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna


Get free email and a permanent address at http://www.netaddress.com/?N=1


IMPORTANT NOTICE:
This e-mail and any attachment to it is intended only to be read or used by
the named addressee.  It is confidential and may contain legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistaken transmission to you.  If you receive this e-mail in error, please
immediately delete it from your system and notify the sender.  You must not
disclose, copy or use any part of this e-mail if you are not the intended
recipient.  The RTA is not responsible for any unauthorised alterations to
this e-mail or attachment to it.