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