BaseAction类型的方法getRequest()引用缺少的类型HttpServletRequest

时间:2013-04-24 11:37:40

标签: java servlets

java.lang.Error: Unresolved compilation problem: 
The method getRequest() from the type BaseAction 
refers to the missing type HttpServletRequest

这是方法:

public String list(){

    QueryFilter filter=new QueryFilter(getRequest());
    filter.addSorted("rowNumber", "asc");
    List<Section> list= sectionService.getAll(filter);

    Type type=new TypeToken<List<Section>>(){}.getType();
    StringBuffer buff = new StringBuffer("{success:true,'totalCounts':")
    .append(filter.getPagingBean().getTotalItems()).append(",result:");

    Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
    buff.append(gson.toJson(list, type));
    SysConfig sectionColumn = sysConfigService.findByKey("sectionColumn");
    buff.append(",columnType:");
    if(sectionColumn!=null){
        buff.append(sectionColumn.getDataValue());
    }else{
        buff.append("2");
    }
    buff.append("}");

    jsonString=buff.toString();

    return SUCCESS;
}

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:-4)

将servlet api添加到类路径中。这将解决问题