Friday, 15 May 2015

jsp - file stored in spring-mvc bean -



jsp - file stored in spring-mvc bean -

i need help.

i using spring-mvc annotations, have defined jsp billbean:

public class billbean { private string address; ....... private annex annex; } public class annex { private string name: ......... private doc doc; } public class doc{ private string name; ......... private byte[] file; }

i need save file in doc class, in jsp set next code:

<form:input type="file" path="annex.doc.file" />

but after doing submit, when attempting validate bean validate class, find doc = null.

i understand problem doc has not been initialized handle spring beans, tried creating new instance in constructor of billbean failed initialize classe doc.

anyone know tell me need prepare problem?.

thank much in advance

i solved problem, problem was returning cloned instance of doc class.

spring set doc on clone instance , instand don´t utilize never.

thanks help.

jsp spring-mvc javabeans

No comments:

Post a Comment