Author
The constructor ActionError(String) is deprecated"!!
divya sharma
Ranch Hand
Joined: Jan 25, 2007
Posts: 87
posted Sep 12, 2007 13:46:00
0
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
Divya
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
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.
Merrill
Consultant, Sima Solutions
subject: The constructor ActionError(String) is deprecated"!!