[code]上传下载ssh和jsp+servlet (组件是fileupload)

遇到错误:
1.
fileupload取编辑框的值乱码。
String value = item.getString();
改为
String value = item.getString("UTF-8");

http://argen.bokee.com/viewdiary.14753538.html

2.
java.sql.SQLException: General error, message from server: "Incorrect string value: '\xD0\xD0\xD2\xB5\xB6\xAF...' for column 'parentclass' at row 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1977)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1163)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1272)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2236)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1741)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1588)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
at org.mram.news.ClassDAO.update(ClassDAO.java:138)

原因是因为mysql在建表时是用intan1编码的(就算建表后改成utf-8)也不行~~~
要删表,再重新建表才行。

3.
[ERROR] 2009-09-10 20:27:45 org.apache.commons.beanutils.PropertyUtils - Method invocation failed.
java.lang.IllegalArgumentException: argument type mismatch

Do you have this setting in your form?
enctype="multipart/form-data"
无设form的编码

4.
[ERROR] 2009-09-11 21:13:35 org.springframework.web.struts.ContextLoaderPlugIn - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/fileinfos' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'fileinfosDaoManager' while setting bean property 'fileinfosDaoManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileinfosDaoManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'fileinfosDao' of bean class [com.ust.service.impl.FileinfosManagerImpl]: Bean property 'fileinfosDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileinfosDaoManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'fileinfosDao' of bean class [com.ust.service.impl.FileinfosManagerImpl]: Bean property 'fileinfosDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by:
org.springframework.beans.NotWritablePropertyException: Invalid property 'fileinfosDao' of bean class [com.ust.service.impl.FileinfosManagerImpl]: Bean property 'fileinfosDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

依赖注入无setter方法~~

5.
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /goselect.do
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)

action无配formbean
action要指定相关的form bean

6.
javax.servlet.ServletException: No getter method for property file1 of bean

<form>标签中的file1在frombean中无对应的file1属性

心得:
1
在struts中jsp的<from>要对应formbean的属性~~~~~
两者的名称很重要~~~~
如果不对应就会提示,很多这些那些的设置属性错误~~~~

file_0:false
file[0]:true

System.out.println("file[0]:"+elements.containsKey("file[0]"));
FileinfosForm f = (FileinfosForm) form;

file[0]:true
file.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值