Java struts2改造项目-->;编译错误

Java struts2改造项目-->;编译错误,java,struts2,Java,Struts2,我有下面的代码,但它有编译错误。它正在从struts1迁移到struts2。我试图在网上搜索,但没有用,例如“resetToken struts2”或“getLocalAddr request”。。。 请帮忙 HttpServletRequest request = ServletActionContext.getRequest(); String serverNumber = request.getLocalAddr().substring(request.getLocalAddr().le

我有下面的代码,但它有编译错误。它正在从struts1迁移到struts2。我试图在网上搜索,但没有用,例如“resetToken struts2”或“getLocalAddr request”。。。 请帮忙

HttpServletRequest request = ServletActionContext.getRequest();

String serverNumber = request.getLocalAddr().substring(request.getLocalAddr().length()-1);
// *it said The method getLocalAddr() is undefined for the type HttpServletRequest* ...

resetToken(request);
//*The method resetToken(HttpServletRequest) is undefined for the type CardAction*

您使用的Java版本是什么?Jdk版本1.6,Struts2核心版本2.1.8修复您的web应用程序版本