请教:我在编译java文件的时候提示如下信息...

qyzj_wanghx 2004-09-03 03:58:05
package org.monotonous.struts;

import java.util.Locale;
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.util.MessageResources;
import org.apache.commons.beanutils.PropertyUtils;

public final class LogonAction extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
Locale locale = getLocale(request);
MessageResources messages = getResources(request);

// Validate the request parameters specified by the user
ActionErrors errors = new ActionErrors();
String username =
(String) PropertyUtils.getSimpleProperty(form, "username");
String password =
(String) PropertyUtils.getSimpleProperty(form, "password");

if ((username != "foo") || (password != "bar"))
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.password.mismatch"));

// Report any errors we have discovered back to the original form
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (mapping.getInputForward());
}

// Save our logged-in user in the session
HttpSession session = request.getSession();
// Do something with session...

// 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"));
}
}



编译时提示如下信息:

"LogonAction.java": Warning #: 368 : class org.apache.struts.action.ActionError in package org.apache.struts.action has been deprecated at line 8, column 33

"LogonAction.java": Warning #: 368 : variable GLOBAL_ERROR in class org.apache.struts.action.ActionErrors has been deprecated at line 34, column 36

"LogonAction.java": Warning #: 368 : class org.apache.struts.action.ActionError in package org.apache.struts.action has been deprecated at line 35, column 20

"LogonAction.java": Warning #: 368 : method add(java.lang.String, org.apache.struts.action.ActionError) in class org.apache.struts.action.ActionErrors has been deprecated at line 34, column 19

"LogonAction.java": Warning #: 368 : method saveErrors(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionErrors) in class org.apache.struts.action.Action has been deprecated at line 39, column 12

Warning #: 369 : There have been deprecation warnings. Please consult the documentation for a better alternative

请高手指点.........谢谢!!!!
...全文
85 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qyzj_wanghx 2004-09-03
  • 打赏
  • 举报
回复
谢谢,已经解决..
wooddy_lee 2004-09-03
  • 打赏
  • 举报
回复
这个好想只是警告吧。ActionError 和 ActionErrors 类已经不建议使用了
好象换成使用ActionMessage 和 ActionMessages 了吧

50,528

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧