Announcement Announcement Module
Collapse
No announcement yet.
multipart/form-data form submit error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • multipart/form-data form submit error

    My FormController has referenceData and onSubmit method ,when I press submit button and post the data, but it still call referenceData method.
    Code:
    FormController:
     protected void initBinder(HttpServletRequest request,
                ServletRequestDataBinder binder) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            dateFormat.setLenient(false);
            binder.registerCustomEditor(Date.class, new CustomDateEditor(
                    dateFormat, false));
            binder.registerCustomEditor(byte[].class,
                    new ByteArrayMultipartFileEditor());
        }
    
        protected ModelAndView onSubmit(HttpServletRequest request,
                HttpServletResponse response, Object command, BindException errors)
                throws Exception {
            SupplyInformation supplyInformation = (SupplyInformation) command;
     ......
            return new ModelAndView(new RedirectView("home.sf?codeId=" + codeId));
        }
    
        protected Map referenceData(HttpServletRequest request, Object command,
                Errors errors) throws Exception {
            Map referenceData = new HashMap(), model = new HashMap();
           ......
            return referenceData;
    
        }
    JSP Form:
    Code:
    <FORM method="post" enctype="multipart/form-data">
    					<TABLE  >
    <tr>
    	<td >content</TD>
    	<td >
    		<spring&#58;bind path="command.content">
    			<TEXTAREA  name="$&#123;status.expression&#125;"  >$&#123;status.value&#125;</TEXTAREA>
    					</spring&#58;bind>
    	</TD>
    </TR>
    <tr>
    	<td>file</TD>
    	<td >
    		<spring&#58;bind path="command.fileAttachmentBytes">
    			<INPUT class="input" type="file" name="$&#123;status.expression&#125;"   />
    					</spring&#58;bind>
    	</TD>
    </TR>
    	<tr>
    							<td ><INPUT class="input" type="submit" value="submit" ></TD>
    						</TR>
    .......
    					</TABLE>
    				</FORM>
    [/quote]

  • #2
    I think you may need to be a bit more specific here. What exacly is the error? Is an exception thrown?

    Comment

    Working...
    X