spring 的问题!困饶我很长时间了,谁能帮我解决下,谢谢!

问题描述

我不知道我在哪里出了问题,但是总是出错,说我的数据引入类型不对,请大家帮下我,下面是我的代码:控制台报的错误为:2008-8-18 23:21:23 org.apache.catalina.core.ApplicationDispatcher invoke严重: Servlet.service() for servlet jsp threw exceptionjava.lang.NumberFormatException: For input string: "name"at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)at java.lang.Integer.parseInt(Integer.java:447)at java.lang.Integer.parseInt(Integer.java:497)at javax.el.ArrayELResolver.coerce(ArrayELResolver.java:153)at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:45)at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)at org.apache.el.parser.AstValue.getValue(AstValue.java:97)at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:923)at org.apache.jsp.category.categoryList_jsp._jspx_meth_c_005fforEach_005f0(categoryList_jsp.java:129)at org.apache.jsp.category.categoryList_jsp._jspService(categoryList_jsp.java:83)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:111)at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:965)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:744)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:348)at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)at java.lang.Thread.run(Thread.java:595)categoryDAO接口:package com.ngworld.bookstore.dao;import java.util.List;public interface CategoryDao extends BaseDao{public List getCategoryList();}categoryHibernate实现类:package com.ngworld.bookstore.hibernate;import java.util.List;import com.ngworld.bookstore.dao.CategoryDao;public class CategoryHibernate extends BaseHibernate implements CategoryDao {public List getCategoryList() {// TODO Auto-generated method stubString hql="from Category p left join p.department order by p.id";return getHibernateTemplate().find(hql);}}categoryService接口:package com.ngworld.bookstore.service;import java.util.List;public interface CategoryService {public List getCategoryList();}categoryManager实现类:package com.ngworld.bookstore.manager;import java.util.List;import com.ngworld.bookstore.dao.CategoryDao;import com.ngworld.bookstore.service.CategoryService;public class CategoryManager implements CategoryService {private CategoryDao categoryDao;public void setCategoryDao(CategoryDao categoryDao) {this.categoryDao = categoryDao;}public List getCategoryList() {// TODO Auto-generated method stubreturn categoryDao.getCategoryList();}}categoryController实现类:package com.ngworld.bookstore.manager;import java.util.List;import com.ngworld.bookstore.dao.CategoryDao;import com.ngworld.bookstore.service.CategoryService;public class CategoryManager implements CategoryService {private CategoryDao categoryDao;public void setCategoryDao(CategoryDao categoryDao) {this.categoryDao = categoryDao;}public List getCategoryList() {// TODO Auto-generated method stubreturn categoryDao.getCategoryList();}}applicationContext-Dao文件:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/hbstpdb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=GBK"/> <property name="user" value="root"/> <property name="password" value="root"/> </bean><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><!-- <prop key="show_sql">true</prop><prop key="schema">hbstpdb</prop>--></props></property><property name="mappingResources"><list> <value>com/ngworld/bookstore/vo/Category.hbm.xml</value><value>com/ngworld/bookstore/vo/Bookcategory.hbm.xml</value><value>com/ngworld/bookstore/vo/Department.hbm.xml</value><value>com/ngworld/bookstore/vo/Book.hbm.xml</value><value>com/ngworld/bookstore/vo/Shoppingcart.hbm.xml</value></list></property></bean><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory"><ref local="sessionFactory" /></property></bean><bean id="txProxyTemplate" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true" abstract="true"><property name="transactionManager"><ref bean="transactionManager" /></property><property name="transactionAttributes"><props><prop key="save*">PROPAGATION_REQUIRED,-Exception</prop><prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop><prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop><prop key="update*">PROPAGATION_REQUIRED,-Exception</prop><prop key="*">PROPAGATION_REQUIRED,readOnly</prop></props></property></bean><!-- 目录分类 --><bean id="categoryDao" class="com.ngworld.bookstore.hibernate.CategoryHibernate"><property name="sessionFactory"><ref bean="sessionFactory"/></property></bean>applicationContext-Service配置文件:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <bean id="categoryManagerTarget" class="com.ngworld.bookstore.manager.CategoryManager"><property name="categoryDao"><ref bean="categoryDao"/></property></bean><bean id="categoryService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" parent="txProxyTemplate"><property name="target"><ref bean="categoryManagerTarget"/></property></bean>applicationContext-Servlet配置文件:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans><bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="interceptors"><list><bean class="com.ngworld.insurancecard.interceptor.RequestEncodingInterceptor"/></list> </property> <property name="mappings"> <props><!-- 目录模块 --> <prop key="/category/categorylist.do">categoryListController</prop></props> </property> </bean><!-- 目录模块 --><bean id="categoryListController" class="com.ngworld.bookstore.controller.category.CategoryListController"><property name="categoryService"><ref bean="categoryService"/></property></bean>我的categroy表:categroyID DepartmentID Name Description1 1 computer computer2 2 science science我的department表:DepartmentID Name Desrciption1 computer computer2 science science这是我的表记录谢谢大家帮我解决下问题,谢谢,这个问题已经困绕我很长时间了!问题补充:抱歉,昨天贴的比较着急忘了贴出pojo文件和hibernate.hbm.xml文件了我在这里补下:pojo文件:category表的pojo文件:package com.ngworld.bookstore.vo;import java.util.HashSet;import java.util.Set;/** * Category generated by MyEclipse Persistence Tools */public class Category extends com.ngworld.bookstore.vo.BaseVo implementsjava.io.Serializable {// Fieldsprivate Integer categoryId;private Department department;private String name;private String description;private Set bookcategories = new HashSet(0);// Constructors/** default constructor */public Category() {}/** minimal constructor */public Category(Department department, String name) {this.department = department;this.name = name;}/** full constructor */public Category(Department department, String name, String description,Set bookcategories) {this.department = department;this.name = name;this.description = description;this.bookcategories = bookcategories;}// Property accessorspublic Integer getCategoryId() {return this.categoryId;}public void setCategoryId(Integer categoryId) {this.categoryId = categoryId;}public Department getDepartment() {return this.department;}public void setDepartment(Department department) {this.department = department;}public String getName() {return this.name;}public void setName(String name) {this.name = name;}public String getDescription() {return this.description;}public void setDescription(String description) {this.description = description;}public Set getBookcategories() {return this.bookcategories;}public void setBookcategories(Set bookcategories) {this.bookcategories = bookcategories;}}department的pojo文件package com.ngworld.bookstore.vo;import java.util.HashSet;import java.util.Set;/** * Department generated by MyEclipse Persistence Tools */public class Department extends com.ngworld.bookstore.vo.BaseVo implementsjava.io.Serializable {// Fieldsprivate Integer departmentId;private String name;private String description;private Set categories = new HashSet(0);// Constructors/** default constructor */public Department() {}/** minimal constructor */public Department(String name) {this.name = name;}/** full constructor */public Department(String name, String description, Set categories) {this.name = name;this.description = description;this.categories = categories;}// Property accessorspublic Integer getDepartmentId() {return this.departmentId;}public void setDepartmentId(Integer departmentId) {this.departmentId = departmentId;}public String getName() {return this.name;}public void setName(String name) {this.name = name;}public String getDescription() {return this.description;}public void setDescription(String description) {this.description = description;}public Set getCategories() {return this.categories;}public void setCategories(Set categories) {this.categories = categories;}}.hbm.xml文件:category.hbm.xml文件<?xml version="1.0" encoding="utf-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><!-- Mapping file autogenerated by MyEclipse Persistence Tools--><hibernate-mapping> <class name="com.ngworld.bookstore.vo.Category" table="category" > <id name="categoryId" type="java.lang.Integer"> <column name="CategoryID" /> <generator class="increment" /> </id> <many-to-one name="department" class="com.ngworld.bookstore.vo.Department" fetch="select"> <column name="DepartmentID" not-null="true" /> </many-to-one> <property name="name" type="java.lang.String"> <column name="Name" length="50" not-null="true" /> </property> <property name="description" type="java.lang.String"> <column name="Description" length="1000" /> </property> <set name="bookcategories" inverse="true"> <key> <column name="CategoryID" not-null="true" /> </key> <one-to-many class="com.ngworld.bookstore.vo.Bookcategory" /> </set> </class></hibernate-mapping>department.hbm.xml文件:<?xml version="1.0" encoding="utf-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><!-- Mapping file autogenerated by MyEclipse Persistence Tools--><hibernate-mapping> <class name="com.ngworld.bookstore.vo.Department" table="department"> <id name="departmentId" type="java.lang.Integer"> <column name="DepartmentID" /> <generator class="increment" /> </id> <property name="name" type="java.lang.String"> <column name="Name" length="50" not-null="true" /> </property> <property name="description" type="java.lang.String"> <column name="Description" length="1000" /> </property> <set name="categories" inverse="true"> <key> <column name="DepartmentID" not-null="true" /> </key> <one-to-many class="com.ngworld.bookstore.vo.Category" /> </set> </class></hibernate-mapping>这个是我的jsp文件:<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>分类管理</title></head><body><form action="#" name="frm"><table width="75%" border="1" align="center"> <tr align="center"> <td colspan="4">信息列表</td> </tr> <tr> <td colspan="4">目录管理&gt;&gt;分类管理&gt;&gt;信息管理</td> </tr> <tr> <td>分类编号</td> <td>分类名称</td> <td>部门</td> <td>部门种类</td> </tr> <c:forEach items="${categoryList}" var="categoryList" varStatus="status"> <tr> <td><c:out value="${status.index+1}"/></td> <td>${categoryList.name}</td> <td>${categoryList.department}</td> <td>${categoryList.description }</td> </tr> </c:forEach></table></form></body></html>我知道意思是string类型转化为number类型的错误,但是我不知道哪里出的问题,谢谢大家帮我解决下!问题补充:上面的categoryController文件贴错了这里是我的categoryController文件 package com.ngworld.bookstore.controller.category; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import com.ngworld.bookstore.service.CategoryService; import com.ngworld.bookstore.vo.Category; public class CategoryListController implements Controller{ private CategoryService categoryService; public void setCategoryService(CategoryService categoryService) { this.categoryService = categoryService; } public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub List categoryList=categoryService.getCategoryList(); request.setAttribute("categoryList",categoryList); return new ModelAndView("/category/categoryList.jsp"); } }

解决方案

at org.apache.jsp.category.categoryList_jsp._jspx_meth_c_005fforEach_005f0(categoryList_jsp.java:129) 把你的categoryList.jsp里面的el表达式仔细的检查下, 看是哪个有问题!
解决方案二:
at org.apache.jsp.category.categoryList_jsp._jspService(categoryList_jsp.java:83) 这段报错信息告诉我们是在categoryList.jsp页面的83行报错的。<tr> <td><c:out value="${status.index+1}"/></td> <td>${categoryList.name}</td> <td>${categoryList.department}</td> <td>${categoryList.description }</td> </tr> 如果是这段代码加载数据的话,估计是在加载第10个左右报错的。你看下你加载的数据。
解决方案三:
你的错误的意思是你将string类型的转化为int出的错引用For input string: "name" 这段代码呢?怎么没有啊。。。估计是你哪里定义的数字,但是传进来的是字母,报的错你断点跟下

时间: 2024-10-05 15:34:18

spring 的问题!困饶我很长时间了,谁能帮我解决下,谢谢!的相关文章

在oracle一个有60万记录的表中删除几十条记录怎么用了很长时间?

oracle 在oracle一个有60万记录的表中删除几十条记录怎么用了很长时间?

win8系统任务管理器需要很长时间才能开启怎么回事?

win8系统任务管理器需要很长时间才能开启怎么回事?: 1.在桌面上使用win+r快捷键打开运行窗口,输入"gpedit.msc"命令,点击回车; 2.在打开的组策略编辑器中,依次展开"用户配置-管理模板-系统-Ctrl+Alt+Del选项",在右侧窗口中找到"删除任务管理器"; 3.双击"删除任务管理器",在弹出的窗口中更改成"未配置"即可.

系统-Win7启动时开在 Starting Windows (四个小球)很长时间...求解决办法

问题描述 Win7启动时开在 Starting Windows (四个小球)很长时间...求解决办法 RT 我用的是 Win7 SP1 64位英文旗舰版 一开始装了360安全卫士然后出现这个问题,之后卸载掉,问题解除,可是最近又发生了这种情况. 机器配置: CPU:I5 3337U 内存:4G 显卡:NV 750GT 4G 硬盘:TOSHIBA 500G 硬盘启动模式 ACHI 已安装ACHI 驱动 硬件检测一切正常,开机后使用流畅,任何程序顿卡现象 尝试安全模式启动正常 尝试msconfig

急!用jdbc中executeQuery()方法执行查询为什么在程序中停顿很长时间,甚至报错。

问题描述 急!用jdbc中executeQuery()方法执行查询为什么在程序中停顿很长时间,甚至报错. 程序中的sql如以下: select t3.*,t1.costPrice as costP,t1.retailPrice as retailP,t1.basicPricing as basicP from goodsGroupCopy t1 left join groupCopyGoods t2 on t1.id = t2.goodsGroupCopyId left join goods t

mysql-MySQL插入数据缓慢,建立session连接需要很长时间是怎么回事?

问题描述 MySQL插入数据缓慢,建立session连接需要很长时间是怎么回事? 为什么在执行Mysql插入的时候会等待20-30秒,就是建立SessionFactory的这个过程. program strt: 2013-09-22 16:22:40.413 complete build SessionFactory: 2013-09-22 16:23:10.299 open session begin transaction time: 2013-09-22 16:23:10.322 这是我在

卡了很长时间 asp.net 无法访问APPLET的JAR 包里的类 环境: IIS+WIN2003

问题描述 ASP+IIS+WIN2003APPLET小应用程序打包JAR文件首先排除路径标签格式等问题,因为我们的同事用JAVASCRIPT+TOMCAT试过可以访问.远程只会报错classnotfound而从本机以远程方式访问会报classnotfoundcausedbyopenhttpconnectionfail所以就怀疑是asp和IIS中可能有什么问题,这个问题卡了很长时间了.访问权限?设置?MEMI?我想应该不存在ASP不支持JAR格式之类的的问题吧.如果所有长法不成功的话,最后就就只有

fpga-请问cyclone1系列的FPGA里的进位链上每个进位单元的延迟时间,手册翻了很长时间都没翻到

问题描述 请问cyclone1系列的FPGA里的进位链上每个进位单元的延迟时间,手册翻了很长时间都没翻到 请问cyclone1系列的FPGA里的进位链上每个进位单元的延迟时间,手册翻了很长时间都没翻到

传漾王跃:站外推广这一步也是我们花很长时间积累的东西

和讯科技消息 3月22日,由艾瑞咨询集团主办的第七届艾瑞年度峰会今日在京举行.本届艾瑞年会历时2天,第一天诸多行业领袖参与高峰论坛,进行交流探讨.次日3月23日,行业精英现场多维度地剖析行业动态.分享成功经验及独到见解.传漾科技创始人兼技术副总裁王跃发表主题演讲. "站外推广这一步也是我们花很长时间积累的东西.比如说通过系统我们能够把它的每一个渠道的访客跟各个系统进行很精确的数据细分",王跃表示. 王跃同时认为,从精细化运营到数据化的驱动销量,打通整个电商运营环节的各个数据孤岛一定能够

IT业的重金属污染在过去的很长时间,一度为人忽视

在化工.冶炼.皮革等行业排放重金属成为司空见惯之时,IT业的重金属污染在过去的很长时间,一度为人忽视.直至不久前,一份<2010IT品牌供应链重金属污染调研>报告出炉,才将IT业由来已久的重金属污染,横陈公众视野.这是由自然之友和公众环境研究中心等34家环保组织,历时八月调查得出的报告.报告显示,在PCB生产企业中,一家名为惠州美锐的电子公司,其当地环保部门通过采集该公司废水监测表明,COD超标96.9倍,铜超标5199倍,镍超标9.6倍,铁超标178.2倍.这是一家为著名IT品牌供货的供应商