Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saveErrors is deprecated

 
ramandeep singh
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any other way to save errors on action file code is some thing like as follows

SubmitResumeStrutsAction.java


dataSource = getDataSource(request);
conn = dataSource.getConnection();
stmt = conn.createStatement();
request.setAttribute("string",strQry.toString());
stmt.executeUpdate(strQry.toString());
}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
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try to read the javadoc?


[ January 18, 2007: Message edited by: Jan Groth ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic