aspose file tools
The moose likes Struts and the fly likes The constructor ActionError(String) is deprecated Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "The constructor ActionError(String) is deprecated"!! " Watch "The constructor ActionError(String) is deprecated"!! " New topic
Author

The constructor ActionError(String) is deprecated"!!

divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: The constructor ActionError(String) is deprecated"!!
 
Similar Threads
struts form being cleared in IE 6
Help needed in resource file
HTTP Status 404 - Servlet action is not available
Error:No valid collection specified for size tag
Data insertion problem