• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

The constructor ActionError(String) is deprecated"!!

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am writting an ActionForm on which I need to mension some error that need to be displayed.

but when I wrote this :
"The constructor ActionError(String) is deprecated"

Message displayed "The constructor ActionError(String) is deprecated"!! Now, what should be the alternate option?? if I dont use "import org.apache.struts.action.ActionError;"

Action Form is
package com.jamesholmes.struts;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;


public class SearchForm extends ActionForm{
private String name = null;
private String ssNum= null;
private String results = null;
public String getName() {
return name;
}
public String getResults() {
return results;
}
public String getSsNum() {
return ssNum;
}
public void setName(String name) {
this.name = name;
}
public void setResults(String results) {
this.results = results;
}
public void setSsNum(String ssNum) {
this.ssNum = ssNum;
}

public void reset(ActionMapping mapping,HttpServletRequest request)
{
name=null;
ssNum= null;
results = null;
}

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
boolean nameEntered = false;
boolean ssNumEntered = false;

if(name!=null && name.length()>0)
{
nameEntered = true;
}
if(ssNum!=null && ssNum.length()>0)
{
ssNumEntered = true;
}

if(!nameEntered && !ssNumEntered)
{

errors.add(null, new ActionError("error.search.critria.missing"));


}
return errors;

}
}

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The entire ActionError class is deprecated, so just replace any reference to ActionError with ActionMessage.

Note that ActionErrors is not deprecated, so leave references to this class alone.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic