最近的项目使用SSH框架 以前没用过
所以自己搭了一个练练手 想实现一个POI解析excel的过程
使用的是struts2
在上传文件的时候是这样写的
jsp:
<s:form namespace="/nameSpace" action="/nameSpace/inPut.action" method="post" enctype="multipart/form-data"> <input type="text" name="hahahaha" /> <s:file name="upload" label="File"/> <s:submit /> <s:reset /> </s:form>
java:
private File upload; private String uploadContentType; private String uploadFilename; public File getUpload() { return upload; } public void setUpload(File upload) { this.upload = upload; } public String getUploadContentType() { return uploadContentType; } public void setUploadContentType(String uploadContentType) { this.uploadContentType = uploadContentType; } public String getUploadFilename() { return uploadFilename; } public void setUploadFilename(String uploadFilename) { this.uploadFilename = uploadFilename; } private String hahahaha; /** * @return the hahahaha */ public String getHahahaha() { return hahahaha; } /** * @param hahahaha the hahahaha to set */ public void setHahahaha(String hahahaha) { this.hahahaha = hahahaha; } public String inPut() throws Exception { System.out.println("contentType:"+this.getUpload()); System.out.println("filename:"+this.getUploadFilename()); System.out.println(hahahaha); System.out.println("----------"); return "ss"; }
呃 配置文件什么的没有问题,应为在我不写这个<s:file>控件时跳入方法是没有问题的
那个hahahaha的值也是可以成功传到后台的
再跳转到页面也是没有问题的
现在的问题是 写了<S:FILE>控件后 往后台跳方法 会报错:
No result defined for action JAVA.checkHibernate.action.CheckHi and result input
JAVA.checkHibernate.action.CheckHi 这个是我的action路径
我在网上查了很久 说是传值的类型不对 <s:file>难道不是File对象吗
究竟是哪里错了
>。<抓狂........