This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Need in Uploading Huge File size 1GB

 
prithivirajan dhamodharan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you give some code snippets - struts configuration files, jsp and action classes?

Thanks
Karthik
 
prithivirajan dhamodharan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
prithivirajan dhamodharan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic