request.getSession().setAttribute(string, int);问题

来源:互联网 发布:mac好用的邮件客户端 编辑:程序博客网 时间:2024/04/28 08:17

request.getSession().setAttribute(string, int);问题

public ActionForward inserttousu(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  Tousu s = (Tousu) form;
  UserDAO ud = new UserDAO();
  try {
   int n = ud.inserttousu(s);
   if (n != 0) {
    request.getSession().setAttribute("proname", n);------MyEclipse中提示此句错误!

当进行添加时,报如下错误:

java.lang.Error: Unresolved compilation problem:
 The method setAttribute(String, Object) in the type HttpSession is not applicable for the arguments (String, int)

 

 

解决:选中项目点右键,Properties -〉Java Compiler。
把Compiler compliance level 改成6.0。