For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > October 2006 > Why my upLoad File does NOT work.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Why my upLoad File does NOT work.
jacksuyu@gmail.com

2006-10-08, 10:00 pm

In my web application, I want to upload a .CSV file from client's
computer and save the data to the database in my server. What I do is:
my xhtml file:
<h:form enctype="multipart/form-data" >

<t:inputFileUpload id="myUploadedFile" storage="file"
value="#{MyBean.csvFile}" immediate="true" />
<input jsfc="h:commandButton" id="import" value="import"
action="#{MyBean.onClick_import}" />
</h:form>

the web.xml
<filter>
<filter-name>extensionsFilter</filter-name>

<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
<init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
</init-param>
</filter>

The problem is when I click the "import" button and try to load the
file, It didn't call the onClick_import method of MyBean. It just did
nothing. But if I move the "import" button out of that form which has
the attribut enctype="multipart/form-data". I could get something. So
why doesn't the button work when it is in that form?

Thanks.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com