Re: Problem with multipart/mixed and file Tag
Brian, Yes I have. html:file property=file / Yann - Original Message - From: Brian Hickey [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 6:52 PM Subject: Re: Problem with multipart/mixed and file Tag Yann, Apologies if this is lame, but do you have an INPUT type=file tag in your jsp? Brian - Original Message - From: Yann Verlynde [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 12:12 PM Subject: Re: Problem with multipart/mixed and file Tag When I try multipart/form-data I have a java.util.NoSuchElementException in my Action Class. It is due to an empty reference: List fileItems = upload.parseRequest(request); Does anyone can help me please? - Original Message - From: Yann Verlynde [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:42 PM Subject: Re: Problem with multipart/mixed and file Tag Thanks, but I tried and it doesn't work... - Original Message - From: Sukhenko, Mikhail (Contr) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:28 PM Subject: RE: Problem with multipart/mixed and file Tag should not you use enctype=multipart/form-data instead of enctype=multipart/mixed? -Original Message- From: Yann Verlynde [mailto:yverlynde;oxade.com] Sent: Tuesday, November 05, 2002 3:46 AM To: Struts Subject: Problem with multipart/mixed and file Tag Hello, I have a problem with this code (a form with content multipart/mixed and an form class). This is my form: html:form action=jsp/Upload.do enctype=multipart/mixed Please select the file that you would like to upload:br / html:file property=theFile /br /br / If you checked the box to write to a file, please specify the file path here:br / html:text property=filePath /br /br / html:submit / /html:form My form class: public class UploadForm extends ActionForm { public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = org.apache.struts.webapp.upload.MaxLengthExceeded; protected FormFile theFile; protected String filePath; public FormFile getTheFile() { return theFile; } public void setTheFile(FormFile theFile) { this.theFile = theFile; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getFilePath() { return filePath; } public void reset() {} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } } This is the exception: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66
RE: Problem with multipart/mixed and file Tag
should not you use enctype=multipart/form-data instead of enctype=multipart/mixed? -Original Message- From: Yann Verlynde [mailto:yverlynde;oxade.com] Sent: Tuesday, November 05, 2002 3:46 AM To: Struts Subject: Problem with multipart/mixed and file Tag Hello, I have a problem with this code (a form with content multipart/mixed and an form class). This is my form: html:form action=jsp/Upload.do enctype=multipart/mixed Please select the file that you would like to upload:br / html:file property=theFile /br /br / If you checked the box to write to a file, please specify the file path here:br / html:text property=filePath /br /br / html:submit / /html:form My form class: public class UploadForm extends ActionForm { public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = org.apache.struts.webapp.upload.MaxLengthExceeded; protected FormFile theFile; protected String filePath; public FormFile getTheFile() { return theFile; } public void setTheFile(FormFile theFile) { this.theFile = theFile; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getFilePath() { return filePath; } public void reset() {} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } } This is the exception: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1012) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107 ) at java.lang.Thread.run(Thread.java:484) root cause java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at
Re: Problem with multipart/mixed and file Tag
Thanks, but I tried and it doesn't work... - Original Message - From: Sukhenko, Mikhail (Contr) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:28 PM Subject: RE: Problem with multipart/mixed and file Tag should not you use enctype=multipart/form-data instead of enctype=multipart/mixed? -Original Message- From: Yann Verlynde [mailto:yverlynde;oxade.com] Sent: Tuesday, November 05, 2002 3:46 AM To: Struts Subject: Problem with multipart/mixed and file Tag Hello, I have a problem with this code (a form with content multipart/mixed and an form class). This is my form: html:form action=jsp/Upload.do enctype=multipart/mixed Please select the file that you would like to upload:br / html:file property=theFile /br /br / If you checked the box to write to a file, please specify the file path here:br / html:text property=filePath /br /br / html:submit / /html:form My form class: public class UploadForm extends ActionForm { public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = org.apache.struts.webapp.upload.MaxLengthExceeded; protected FormFile theFile; protected String filePath; public FormFile getTheFile() { return theFile; } public void setTheFile(FormFile theFile) { this.theFile = theFile; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getFilePath() { return filePath; } public void reset() {} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } } This is the exception: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1012) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107 ) at java.lang.Thread.run(Thread.java:484) root cause
Re: Problem with multipart/mixed and file Tag
Yann, Apologies if this is lame, but do you have an INPUT type=file tag in your jsp? Brian - Original Message - From: Yann Verlynde [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 12:12 PM Subject: Re: Problem with multipart/mixed and file Tag When I try multipart/form-data I have a java.util.NoSuchElementException in my Action Class. It is due to an empty reference: List fileItems = upload.parseRequest(request); Does anyone can help me please? - Original Message - From: Yann Verlynde [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:42 PM Subject: Re: Problem with multipart/mixed and file Tag Thanks, but I tried and it doesn't work... - Original Message - From: Sukhenko, Mikhail (Contr) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 5:28 PM Subject: RE: Problem with multipart/mixed and file Tag should not you use enctype=multipart/form-data instead of enctype=multipart/mixed? -Original Message- From: Yann Verlynde [mailto:yverlynde;oxade.com] Sent: Tuesday, November 05, 2002 3:46 AM To: Struts Subject: Problem with multipart/mixed and file Tag Hello, I have a problem with this code (a form with content multipart/mixed and an form class). This is my form: html:form action=jsp/Upload.do enctype=multipart/mixed Please select the file that you would like to upload:br / html:file property=theFile /br /br / If you checked the box to write to a file, please specify the file path here:br / html:text property=filePath /br /br / html:submit / /html:form My form class: public class UploadForm extends ActionForm { public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = org.apache.struts.webapp.upload.MaxLengthExceeded; protected FormFile theFile; protected String filePath; public FormFile getTheFile() { return theFile; } public void setTheFile(FormFile theFile) { this.theFile = theFile; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getFilePath() { return filePath; } public void reset() {} public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } } This is the exception: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66