File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes saveErrors is deprecated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "saveErrors is deprecated" Watch "saveErrors is deprecated" New topic

saveErrors is deprecated

ramandeep singh

Joined: Jan 16, 2007
Posts: 13
is there any other way to save errors on action file code is some thing like as follows

dataSource = getDataSource(request);
conn = dataSource.getConnection();
stmt = conn.createStatement();
}catch(java.sql.SQLException sql) {
ActionErrors errors = new ActionErrors();
errors.add("sqlError",new ActionMessage("errors.SQL",sql));

// Report any errors we have discovered
if ( !errors.isEmpty() ) {

saveErrors(request, errors);
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
did you try to read the javadoc?

[ January 18, 2007: Message edited by: Jan Groth ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Thanks, Jan for pointing this out. This is confusing to a lot of people. Neither the ActionErrors class nor the saveErrors method of the Action class is deprecated in any version of Struts 1.

Furthermore, since ActionErrors is a subclass of ActionMessages, you can still pass an instance of ActionErrors to the saveMessages method and it will work just fine. It's just that now you have the choice of using either ActionMessages or ActionErrors when creating error messages in your action class.

Consultant, Sima Solutions
I agree. Here's the link:
subject: saveErrors is deprecated
jQuery in Action, 3rd edition