struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Eichberger <webmas...@java.at>
Subject Re: <html:file> tag
Date Thu, 03 Oct 2002 15:34:57 GMT
What I do:

JSP file:

<html:form method="post" action="/upload" enctype="multipart/form-data" >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
                 <tr>
                   <td colspan="5"><html:file property="theFile" /></td>
                   <img src="picts/blind.gif" width="30" height="1" border="0">
                   <td><html:submit value=" Go " /></td>
                 </tr>
</table>
</html:form>



UploadActionForm:

protected FormFile theFile;

with get/set methods




UploadAction:perform:

if ( file != null )
{
...
stream = file.getInputStream();

zipFile = new File( user.path, user.kurzname + "-upload.zip" );
bos = new BufferedOutputStream( new FileOutputStream( zipFile ) );

int bytesRead = 0;
int count = 0;
byte[] buffer = new byte[ 8192 ];
while ( ( bytesRead = stream.read( buffer, 0, 8192 ) ) != -1 )
{
bos.write(buffer, 0, bytesRead);
count += bytesRead;


and so on...



At 11:09 03.10.2002 -0400, Matt Sales wrote:
>Hello,
>I'm having trouble with the <html:file> tag...
>
>Here's a snippet of my jsp:
>
>enctype="multipart/form-data"> ... I've also tried the tag using the 
>accepts attribute, accepts="java.io.File", and accepts="java.io.String", 
>with, of course, the corresponding property in the actionForm set to the 
>correct type. Every time the form is submitted, I get a Servlet Exception: 
>BeanUtils.populate and ArgumentTypeMismatchException. Am I missing 
>something here? Should the type of the upload actionForm property be File? 
>String? something else? If anyone knows of any documentation out there 
>about this, I'd appreciate it. Thanks, Matt -- To unsubscribe, e-mail: For 
>additional commands, e-mail:

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message