java 没有提示信息,ActionErrors没有提示信息

ActionErrors没有提示信息,这是我的 actionform :

import org.apache.struts.action.*;

import javax.servlet.http.*;

import java.io.Serializable;

public class OrderCarForm extends org.apache.struts.validator.ValidatorForm

implements Serializable {

private String errormessage;

private String password;

private String username;

public OrderCarForm()

{

}

public String getErrormessage()

{

return errormessage;

}

public void setErrormessage(String errormessage) {

this.errormessage = errormessage;

}

public String getPassword() {

return password;

}

public void setPassword(String password) {

this.password = password;

}

public String getUsername() {

return username;

}

public void setUsername(String username) {

this.username = username;

}

public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest)

{

/**@todo: finish this method, this is just the skeleton.*/

ActionErrors errors = new ActionErrors();

OrderCarForm form = new OrderCarForm();

try

{

if (username.equals("")) {

errors.add("username", new ActionError("username.errors"));

//errors.add(errors.GLOBAL_MESSAGE, new ActionMessage("username.errors"));

form.setErrormessage("用户名称不可以为空!");

//errors.add("error",new ActionMessage("用户名不可以为空!")) ;

}

if (password.equals(""))

errors.add("password", new ActionError("password.error"));

}

catch(Exception e)

{

System.out.println(e.getMessage() );

errors = null;

}

return errors;

}

public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest)

{

}

}

这是我的 action ;

import org.apache.struts.action.*;

import javax.servlet.http.*;

import org.apache.commons.logging.Log;


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部