package example;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
public class LogonAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
Locale locale = getLocale(request);
//MessageResources messages = getResources();
ActionErrors errors = new ActionErrors();
String username = ((LogonForm) form).getUsername();
String password = ((LogonForm) form).getPassword();
// Report any errors we have discovered back to the original form
if (!errors.equals()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
// Save our logged-in user in the session
HttpSession session = request.getSession();
session.setAttribute("user", "ok");
if (servlet.getDebug() >= 1)
servlet.log("LogonAction: User :" +
"' logged on in session " + session.getId());
// Remove the obsolete form bean
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
// Forward control to the specified success URI
return (mapping.findForward("success"));
}
}
运行出现下面的错误:
D:\jakarta-tomcat-5.0.28\webapps\logon\WEB-INF\classes\example\LogonAction.java:35: 无法将 java.lang.Object 中的 equals(java.lang.Object) 应用于 ()
if (!errors.equals()) {
^
D:\jakarta-tomcat-5.0.28\webapps\logon\WEB-INF\classes\example\LogonAction.java:43: 找不到符号
符号: 方法 getDebug()
位置: 类 org.apache.struts.action.ActionServlet
if (servlet.getDebug() >= 1)
^
注意: D:\jakarta-tomcat-5.0.28\webapps\logon\WEB-INF\classes\example\LogonAction.java 使用或覆盖了已过时的 API。
注意: 要了解详细信息,请使用 -Xlint:deprecation 重新编译。
2 错误
Process completed.
上网查了半天也没找出原因,找API也没找到getDebug(),
谁帮忙找一下错误原因。