wood burning stoves 2.0*
The moose likes Struts and the fly likes Help Need in Uploading Huge File size 1GB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help Need in Uploading Huge File size 1GB" Watch "Help Need in Uploading Huge File size 1GB" New topic
Author

Help Need in Uploading Huge File size 1GB

prithivirajan dhamodharan
Greenhorn

Joined: Feb 19, 2007
Posts: 6
Hi,

Not able to upload Huge file of size 1GB. While trying that getting exception page

javax.servlet.ServletException: Request[/em/generalSection] does not contain handler parameter named 'operation'. This may be caused by whitespace in the label text.
at org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:222)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
.....

I tried with <controller> to write in seperate memory in
struts-config.xml, even that is not helping me.

Help me to get rid of displaying exception page.
Karthik Krishnamurthy
Ranch Hand

Joined: Feb 04, 2005
Posts: 118
Could you give some code snippets - struts configuration files, jsp and action classes?

Thanks
Karthik
prithivirajan dhamodharan
Greenhorn

Joined: Feb 19, 2007
Posts: 6
Thanks for your reply, Below is the code snippet..

In JSP,
<code>
<html:form action="/em/generalSection.action" method="post"
enctype="multipart/form-data" >
....
..
<html:file property="theFile" style="width:300" />

....
</html:form>
</code>
In Struts-config.xml
<code>
<controller
processorClass="org.apache.struts.action.RequestProcessor"
contentType="multipart/form-data"
memFileSize="10M"/>

&
Action Mapping is

<action
path="/em/generalSection"type="com.gm.efecs.em.execution.action.GeneralSectionAction"
name="generalSectionForm"
scope="session"
validate="true"
parameter ="operation"
input="em.execution.generalSection">
<forward name="display.generalSection"path="em.execution.generalSection"/>

</code>

It is Not hitting Action Class. And give's the above exception page
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
From your code, it looks like you're using a subclass of DispatchAction to do your upload. I would recommend that you not do that. In multipart forms used for uploads, parameters are handled differently, and it looks like Struts is having trouble recognizing the handler parameter. Try doing your upload with a regular Action class and see if that fixes it.

I'd also recommend that you remove the entry

from the controller stanza of your struts-config.xml file. This sets the default for all pages. I don't think you want "multipart/form-data" to be the default content type for all your forms.


Merrill
Consultant, Sima Solutions
prithivirajan dhamodharan
Greenhorn

Joined: Feb 19, 2007
Posts: 6
Thanks for your suggestion.

Appending dispatch parameter attribute in form action before submitting resolved my problem.

eg.,
<code>
function uploadDocument(){
document.forms[0].action = document.forms[0].action +
"?operation=uploadGeneralSectionDoc";
doument.forms[0].submit();

}
</code>
before i was setting the parameter attribute using hidden field,
<code>
document.forms[0].operation.value="uploadGeneralSectionDoc";
</code>

I belive in case of huge file upload the form values are discared. Correct me if i am wrong.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The form values are not discarded, but they are all part of a large input stream of data that Sruts must sort out. I suppose it is possible that a large file may make it more difficult or impossible for Struts to do that.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help Need in Uploading Huge File size 1GB
 
Similar Threads
Split and Merge large zip files
Writing to a file in Java..?
Upload files of size more than 100mb
java.lang.OutOfMemoryError: Java heap space
how to resolve OutOfMemoryError