关于tiles2用代码取tiles容器时出现的问题

在struts2的Action中

HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
TilesContainer container = ServletUtil.getContainer(request
		 .getSession().getServletContext());
container.render("layout2",request, response);

 在这里面

container.render

 一直在报错

The method render(String, Object[]) in the type TilesContainer is not applicable for the arguments (String, HttpServletRequest, HttpServletResponse)

 

弄了一天才知道,原来是eclipse的 jdk 版本问题

项目右击->properties->java compiler -> compliance level ->由1.4改为1.6

1.4到1.6版本的区别有:装箱,可变参数,泛型

你可能感兴趣的:(eclipse,jdk)