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;
總結
以上是生活随笔為你收集整理的java 没有提示信息,ActionErrors没有提示信息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java反码算术运算求和,位运算的妙用,
- 下一篇: matlab中显示ycbcr图像,rgb