日期:2014-05-20  浏览次数:20641 次

SSH配置过程出点小问题
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class logintest extends ActionSupport {

    private String name;
    private String password;
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public String execute() throws Exception {

        ServletActionContext.getRequest().setAttribute("name", name);
        ServletActionContext.getRequest().setAttribute("password", password);


        return SUCCESS;
    }
红色的地方出错了,老是报:Access restriction: The method setAttribute(String, Object) from the type ServletRequest is not accessible due to restriction on required library D:\应用\eclipse\jre\lib\ext\servlet-api.jar,怎么解决?
SSH java

------解决方案--------------------
jar包有问题吧
------解决方案--------------------
http://blog.csdn.net/hexin373/article/details/7175325
试试这个,,可以的