Link to home
Start Free TrialLog in
Avatar of a122178
a122178

asked on

Type mismatch: cannot convert from Integer to int

I got this error. I have checked my code. I cannot find the result. Please help~~!!!

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 86 in the jsp file: /submit.jsp
Generated servlet error:
Type mismatch: cannot convert from Integer to int

An error occurred at line: 86 in the jsp file: /submit.jsp
Generated servlet error:
The method get(Object) in the type HashMap is not applicable for the arguments (int)

An error occurred at line: 86 in the jsp file: /submit.jsp
Generated servlet error:
The method get(Object) in the type HashMap is not applicable for the arguments (int)


      org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
      org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a122178
a122178

ASKER

item.put(_item.getDblProductID(), _item)
 if _item.getDblProductID() is an integer, is it possible to do this way?

Thank you so much
you would need to use:

item.put(new Integer(_item.getDblProductID()), _item);
Avatar of a122178

ASKER

How about if I want to get from an int?

item.get(new Integer( int) ) , is that right?
correct
Avatar of a122178

ASKER

It still comes out even I change. After I refresh the screen it works.
Why?