• 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

The constructor ActionError(String) is deprecated"!!

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic