Subir archivo pdf con Struts

"estaisaderezados" <[email protected]>
Newsgroups gmane.comp.java.javaspain
Message-ID <[email protected]>
Estoy tratando de subir un archivo pdf con struts, supuestamente
deberia ser algo sencillo pero no encuentro el problema. Estoy usando
la libreria commons-fileupload.jar.

Este es el error que me da:

GRAVE: Servlet.service() para servlet action lanzó excepción
java.lang.IllegalArgumentException: Cannot invoke
es.aplos.plotkin.ubadmin.form.FormContenido.setArchivo - argument type
mismatch at
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)

Esto es el código del Action

		FormContenido formContenido = (FormContenido)form;

		// Process the FormFile
		FormFile myFile = formContenido.getArchivo();
		String contentType = myFile.getContentType();
		//Get the file name
		String fileName    = myFile.getFileName();
		//int fileSize       = myFile.getFileSize();
		byte[] fileData    = myFile.getFileData();
		//Get the servers upload directory real path name
		String filePath = getServlet().getServletContext().getRealPath("/")
+"upload";
		/* Save file on the server */
		System.out.println("filePath:" +filePath);
		if(!fileName.equals("")){  
			System.out.println("Server path:" +filePath);
			//Create file
			File fileToCreate = new File(filePath, fileName);
			//If file does not exists create file                      
			if(!fileToCreate.exists()){
				FileOutputStream fileOutStream = new FileOutputStream(fileToCreate);
				fileOutStream.write(myFile.getFileData());
				fileOutStream.flush();
				fileOutStream.close();
			}  


		}
		//Set file name to the request object
		request.setAttribute("fileName",fileName);

		return mapping.findForward("ok");

Esto es en el jsp:

<html:form action="/altaContenido" enctype="multipart/form-data">
<tr><td class="ub_textoform">archivo</td><td><html:file
property="archivo"/></td></tr>
<html:submit styleClass="ub_submit">grabar</html:submit> 
<html:reset styleClass="ub_submit">restaurar</html:reset>
</html:form>

Esto es en el config-struts.xml

<form-bean name="formAltaContenido"
type="es.aplos.plotkin.ubadmin.form.FormContenido">
<form-property name="archivo" type="org.apache.struts.upload.FormFile"/>
</form-bean>

Esto en el FormAction

private FormFile archivo;

	 /**
	   * @return Returns the theFile.
	   */
	  public FormFile getArchivo() {
	    return archivo;
	  }
	  /**
	   * @param theFile The FormFile to set.
	   */
	  public void setArchivo(FormFile archivo) {
	    this.archivo = archivo;
	  }

Un saludo,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.