• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to get a complete string from actionmessage in action class

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I wrote an action class to retrieve the records in an excel file and insert into database.
The action reads the records into an ArrayList of actiomform and check it by using validator in the action class.

If the actionform is invalid, I need to put the line number and the error into a log file and send back to the user.

However, the returned is ActionMessages which contains arguments. How can I convert it to a String to put into a file?

Hope someone can help. Thanks.
[ June 16, 2006: Message edited by: Donald Fung ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do this by taking advantage of some of the methods available to your Action class through it's superclass, the Struts Action class. The important methods are getResources() and getLocale(). The code below should accomplish what you want. In this code, the variable "errors" represents an ActionMessages instance.

[ June 16, 2006: Message edited by: Merrill Higginson ]
 
Donald Fung
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get it.
Thanks, Merrill.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic