3
package com.achala.saraswathi.action;

import com.achala.saraswathi.data.AdminBE;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class AdminLoginAction extends ActionSupport{


    private AdminBE adminBE;

    public String execute(){
        return Action.SUCCESS;
    }


    public String adminLogin(){
        if(adminBE.getUserName().equals("admin")&&adminBE.getPassword().equals("admin")){
            return Action.SUCCESS;
        }
        addActionError("Invalid username or password");
        return Action.INPUT;
    }

    public AdminBE getAdminBE() {
        return adminBE;
    }

    public void setAdminBE(AdminBE adminBE) {
        this.adminBE = adminBE;
    }       
}

单击该提交按钮后

ParametersInterceptor - Unexpected Exception caught Error setting expression 'x' with value 

错误来了,我不知道为什么?

4

2 回答 2

2

I suspected that your form is using submit button with type="image". With this button it will post parameter x,y to the request parameter. So to avoid this error you can:

  • Use another type of button such as with background image
  • Add x, y property to your action class
于 2013-12-25T10:01:10.330 回答
0

要在不破坏对象模型的情况下解决此问题,请在此处查看详细答案:

如何使用图像类型按钮以 HTML 表单提交时删除 x 和 y?

于 2014-12-12T17:45:16.523 回答