<FORM name="formuser" enctype="multipart/form-data" method="POST">
<input  type="file" name="files" >
<input type="submit" id="submit" value="提交表单" />
</FORM>
这个是我的提交页面代码
public class CallingValidator implements Validator {
public boolean supports(Class clazz) {
return CallingInfo.class.isAssignableFrom(clazz);
} public void validate(Object obj, Errors errors) {
CallingInfo info =(CallingInfo)obj;

}}
判断代码。public class CallingInfoAction extends SimpleFormController {
private String UploadFile="files";

protected ModelAndView onSubmit(HttpServletRequest req,
HttpServletResponse rep, Object cmd, BindException ex) {
ModelAndView mv = null;
return mv; } protected Object formBackingObject(HttpServletRequest request)
throws Exception {
System.out.println(new java.util.Date()+" -> "+CallingInfoAction.class.getName()+" -> formBackingObject");

String action = Tools.getString(request.getParameter("action"));
CallingInfo  callinfo = new CallingInfo();
callinfo.setActionType(action);
if(action.equals("edit")){
String id =request.getParameter("id");
ClassPathXmlApplicationContext tx = new ClassPathXmlApplicationContext(
ConfigMessage.APPLICATIONCONTEXT);
DaoImpl dao = (DaoImpl) tx.getBean(ConfigMessage.BEAN);

Callingimg  call = (Callingimg)dao.get(Callingimg.class, Integer.valueOf(id)); callinfo.setFiles(null);

tx.close();
}
return callinfo;
}}
逻辑层代码 

解决方案 »

  1.   

    我的问题就出现了,我在页面上提交file 但是一直都是在本页上显示,没有CallingInfoAction  -》onSubmit 里面,进入了CallingValidator  ,一直在本页显示,但是去掉file上传 改成text 就可以进入CallingInfoAction  -》onSubmit  进入数据保存
      

  2.   

    file文件是一种数据结构,不想text传的是字符串,
    比如啊,struts里面有个FormFile类来专门处理这个东动,
      

  3.   

    enctype="multipart/form-data"怀疑是这句问题
      

  4.   

    FormFile 变量声明了吗?
    有没有出错信息?
      

  5.   

    去google上搜索一下 struts upload的参考把
      

  6.   

    to alley_zhan(晓柯)  
       没有任何的出错信息 以前的几个上传附件也是这样做的没有任何的问题。这次能了几天了 ,还是不能提交,不是说,不能在后面的页面得到参数,而是提交就感觉在刷新本页一样,只是输入的数据保留而已。
     还有这个是spring mvc 不是struts  请大家帮忙顶 ,顶也有分的。这个问题太奇怪了。
      

  7.   

    callinfo.setActionType(action);
    是不是这里写错了?你有设置这个action吗?
      

  8.   

    action 只不过是一个String 值
      

  9.   

    找到报错了。 
    在上传附件的时候 他会报这个错误,
    Failed to convert property value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [byte[]] for property files; nested exception is java.lang.IllegalArgumentException: argument type mismatch 但是我找不到这个错误 错在那里了?
      

  10.   

    http://community.csdn.net/Expert/topic/4924/4924883.xml