A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 尤圣回 中级黑马   /  2012-9-17 13:18  /  1750 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. type Exception report

  2. message javax.el.ELException: Cannot convert 1 of type class java.lang.String to class java.lang.Integer

  3. description The server encountered an internal error (javax.el.ELException: Cannot convert 1 of type class java.lang.String to class java.lang.Integer) that prevented it from fulfilling this request.

  4. exception

  5. org.apache.jasper.JasperException: javax.el.ELException: Cannot convert 1  of type class java.lang.String to class java.lang.Integer
  6.         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
  7.         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
  8.         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
  9.         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  10.         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  11.         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
  12.         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
  13.         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
  14.         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
  15.         org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
  16.         javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  17.         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


  18. root cause

  19. javax.el.ELException: Cannot convert 1  of type class java.lang.String to class java.lang.Integer
  20.         org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:312)
  21.         org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:283)
  22.         org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:396)
  23.         org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:191)
  24.         org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:985)
  25.         org.apache.jsp.WEB_002dINF.page.product.producttypelist_jsp._jspx_meth_c_005fforEach_005f0(producttypelist_jsp.java:174)
  26.         org.apache.jsp.WEB_002dINF.page.product.producttypelist_jsp._jspService(producttypelist_jsp.java:113)
  27.         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  28.         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  29.         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
  30.         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
  31.         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  32.         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  33.         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1078)
  34.         org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:396)
  35.         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
  36.         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
  37.         org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
  38.         javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  39.         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  40. 这个是页面
  41. [code]<%@ page contentType="text/html;charset=UTF-8" %>
  42. <%@ include file="/WEB-INF/page/share/taglib.jsp" %>
  43. <html>
  44. <head>
  45. <title>产品类别管理</title>
  46. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  47. <link rel="stylesheet" href="/css/vip.css" type="text/css">
  48. <script language="JavaScript">
  49. <!--

  50. //-->
  51. </script>
  52. <SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
  53. </head>

  54. <body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0">


  55.   <table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
  56.     <tr ><td colspan="6"  bgcolor="6f8ac4" align="right">
  57.    总记录数:${pageView.totalrecord } |每页显示数:${pageView.totalrecord }条 |总页数:${pageView.totalpage }
  58.     <c:forEach begin="${pageView.pageindex.startindex} " end="${pageView.pageindex.endindex }" var="wp">
  59.     <c:if test="${pageView.currentpage==wp }"><b> 第${wp }页</b></c:if>
  60.     <c:if test="${pageView.currentpage!=wp }"> <a href='<html:rewrite action="/control/production/type/list"/>?page=${wp}' class="a03">  第${wp }页</a></c:if>

  61.     </c:forEach>       
  62.    </td></tr>
  63.     <tr>
  64.       <td width="8%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">代号</font></div></td>
  65.       <td width="5%" nowrap bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">修改</font></div></td>
  66.       <td width="20%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">产品类别名称</font></div></td>
  67.           <td width="10%" nowrap bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">创建下级类别</font></div></td>
  68.           <td width="15%" bgcolor="6f8ac4"><div align="center"><font color="#FFFFFF">所属父类</font></div></td>
  69.           <td nowrap bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">备注</font></div></td>
  70.     </tr>
  71. <!---------------------------LOOP START------------------------------>
  72. <c:forEach items="${pageView.records }" var="productType">
  73.     <tr>
  74.       <td bgcolor="f5f5f5"> <div align="center">${productType.typeid }</div></td>
  75.       <td bgcolor="f5f5f5"> <div align="center">
  76.           <img src="images/edit.gif" width="15" height="16" border="0"></a></div></td>
  77.       <td bgcolor="f5f5f5"> <div align="center"><a href="">${productType.typename }</a></div></td>
  78.           <td bgcolor="f5f5f5"> <div align="center"><a href="">创建子类别</a></div></td>
  79.           <td bgcolor="f5f5f5" align="center"><c:if test="${!empty productType.parent }">${productType.parent.name }</c:if></td>
  80.           <td bgcolor="f5f5f5">${productType.note }</td>
  81.         </tr>
  82. </c:forEach>
  83.     <!----------------------LOOP END------------------------------->
  84.     <tr>
  85.       <td bgcolor="f5f5f5" colspan="6" align="center"><table width="100%" border="0" cellspacing="1" cellpadding="3">
  86.           <tr>
  87.             <td width="5%"></td>
  88.               <td width="85%">
  89.               <input name="AddDic" type="button" class="frm_btn" id="AddDic" onClick="javascript:window.location.href='<html:rewrite action="/control/product/type/manage"/>?method=addUI&parentid=${param.parentid}'" value="添加类别"> &nbsp;&nbsp;
  90.                           <input name="query" type="button" class="frm_btn" id="query" onClick="javascript:window.location.href='<html:rewrite action="/control/product/type/manage"/>?method=queryUI'" value=" 查 询 "> &nbsp;&nbsp;
  91.             </td>
  92.           </tr>
  93.         </table></td>
  94.     </tr>
  95.   </table>
  96. </body>
  97. </html>
复制代码
[/code]
  1. package cn.mu.web.action.product;
  2. 这个是sturts1.3的action代码 其他模块测试正常
  3. import java.util.LinkedHashMap;

  4. import javax.annotation.Resource;
  5. import javax.servlet.http.HttpServletRequest;
  6. import javax.servlet.http.HttpServletResponse;

  7. import org.apache.struts.action.Action;
  8. import org.apache.struts.action.ActionForm;
  9. import org.apache.struts.action.ActionForward;
  10. import org.apache.struts.action.ActionMapping;
  11. import org.springframework.stereotype.Controller;

  12. import cn.mu.bean.PageIndex;
  13. import cn.mu.bean.PageView;
  14. import cn.mu.bean.QueryResult;
  15. import cn.mu.bean.WebTool;
  16. import cn.mu.bean.product.ProductType;
  17. import cn.mu.service.product.ProductTypeService;
  18. import cn.mu.web.formbean.product.ProductTypeForm;

  19. @Controller("/control/product/type/list")
  20. public class ProductTypeAction extends Action {
  21.         @Resource(name="productTypeServiceBean")
  22.         private ProductTypeService productTypeService;
  23.        
  24.         @Override
  25.         public ActionForward execute(ActionMapping mapping, ActionForm form,
  26.                         HttpServletRequest request, HttpServletResponse response)
  27.                         throws Exception {
  28.                 ProductTypeForm formbean=(ProductTypeForm)form;
  29.                 PageView<ProductType> pageView=new PageView<ProductType>(12, formbean.getPage());
  30.                
  31.                 int firstindex=(pageView.getCurrentpage()-1)*pageView.getMaxresult();
  32.                 LinkedHashMap<String, String>orderby=new LinkedHashMap<String,String>();
  33.                 orderby.put("typeid", "desc");
  34.                 QueryResult<ProductType>qr=productTypeService.getScrollData(ProductType.class, firstindex, pageView.getMaxresult(), "o.visible=?1", new Object[]{true}, orderby);
  35.           
  36.                 pageView.setQueryResult(qr);
  37.                
  38.                
  39.                 request.setAttribute("pageView",pageView);
  40.                
  41.                 return mapping.findForward("list");
  42.         }

  43.        
  44. }
复制代码

1 个回复

倒序浏览
Cannot convert 1 of type class java.lang.String to class java.lang.Integer
类型转化错误,无法从String类型转到Integer!

有出错位置提示的,你点开每条去排查。

如果不行,把你的项目打包上传来看下。

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马