You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anjib Mulepati <an...@hotmail.com> on 2010/11/10 15:56:02 UTC

Problem with Struts 1 form

I am writing file upload application in Struts 1.3.8. The problem I am 
having is whenever I have file over 200MB to be upload application 
doesn't work properly. I have couple of text field beside files upload 
and those field value are shown null if I try to upload file over 200MB.

JSP File
----------
<html:form styleId="uploadForm" action="/upload"  
focus="transactionName" method="post" enctype="multipart/form-data" >
<div id="errorPlace" style="font-weight: bold; color: #b80000;" 
aria-labelledby="errors" aria-live="assertive"><html:errors /></div>
<label for="transactionName" class="formLabel"><bean:message 
key="transfer.name"/></label>
<html:text title="Transaction Name" styleId="transactionName" 
property="trans_name" tabindex="1" size="35" />
<br />

<label for="recipientsName" class="formLabel"><bean:message 
key="transfer.recipients"/></label>
<html:textarea title="Receipient Addresses" rows="2" 
styleId="recipientsName" property="recpt_name" tabindex="2" cols="75" />
<br />

<div id="fileSection" style="width: 345px" >
<label for="upload_0" class="formLabel"><bean:message 
key="transfer.upload"/></label>
<input title="File1" type="file" name="testFile[0]" id="upload_0" 
tabindex="3" size="60" /><br />
<input title="File2" type="file" name="testFile[1]" id="upload_1" 
tabindex="4" size="60"/><br>
<input title="File3" type="file" name="testFile[2]" id="upload_2" 
tabindex="5" size="60"/><br>
<input title="File4" type="file" name="testFile[3]" id="upload_3" 
tabindex="6" size="60"/><br>
</div>

<input title="Upload File" id="submit"  type="submit" name="submit" 
class="submitbutton" tabindex="8" value='<bean:message key="button.send" 
/>' /><br />
</html:form>

ActionForm
----------------
public class UploadForm extends org.apache.struts.action.ActionForm {

     private String trans_name;
     private String recpt_name;
    private List testFile;

     /**
      *
      */
     public UploadForm() {
         super();
         testFile = new ArrayList();
     }

     public FormFile getTestFile(int i){
         return (testFile.size() > i) ? (FormFile)testFile.get(i) : null;
     }

     public List getList(){
         return testFile;
     }

     public void setTestFile(int i, FormFile f){
         if(f.getFileSize() <= 0){
             f.destroy();
         }else{
             testFile.add(f);
         }
     }

     public int getFileCount(){
         return testFile.size();
     }

     public String getRecpt_name() {
         return recpt_name;
     }

     public void setRecpt_name(String recpt_name) {
         this.recpt_name = recpt_name;
     }

     public String getTrans_name() {
         return trans_name;
     }

     public void setTrans_name(String trans_name) {
         this.trans_name = trans_name;
     }



     /**
      * This is the action called from the Struts framework.
      * @param mapping The ActionMapping used to select this instance.
      * @param request The HTTP Request we are processing.
      * @return set of errors.
      */
     @Override
     public ActionErrors validate(ActionMapping mapping, 
HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
         String transactionName = getTrans_name();             // HERE I 
AM GETTING NULL IF FILE SIZE IS > 200MB
         String recipientName = getRecpt_name();                // FOR 
BOTH transactionName and recipientName.

         if(transactionName == null){
             errors.add("error", new 
ActionMessage("error.transactionName"));
         }
         if(recipientName == null){
             errors.add("error", new ActionMessage("error.recipientName"));
         }
         return errors;
     }
}


Any help will be appreciated.
Anjib




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with Struts 1 form

Posted by Li Ying <li...@gmail.com>.
> 3. No such value is set. So I guess it is taking default value right now.


As I said, You may need change it to more than 200MB.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with Struts 1 form

Posted by Anjib <an...@hotmail.com>.
  1. No proxy server in between client PC and Web App Server
     If yes how it will affect?

2. No exception just give me error message for null value of those fields.

3. No such value is set. So I guess it is taking default value right now.

Anjib
On 11/10/2010 8:56 PM, Li Ying wrote:
> (1)Is there any Proxy Server between the client PC and the Web App Server?
>
> (2)When the action going wrong, is there any Error or Exception
> message on the Server side?
>
> (3)There is a configuration item to control the max-file-size you can
> upload. You may need change it to more than 200MB.
> [maxFileSize - The maximum size (in bytes) of a file to be accepted as
> a file upload. Can be expressed as a number followed by a "K", "M", or
> "G", which are interpreted to mean kilobytes, megabytes, or gigabytes,
> respectively. [250M] (optional)]
> for more information, see:
> http://struts.apache.org/1.3.10/userGuide/configuration.html#struts-config
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with Struts 1 form

Posted by Li Ying <li...@gmail.com>.
(1)Is there any Proxy Server between the client PC and the Web App Server?

(2)When the action going wrong, is there any Error or Exception
message on the Server side?

(3)There is a configuration item to control the max-file-size you can
upload. You may need change it to more than 200MB.
[maxFileSize - The maximum size (in bytes) of a file to be accepted as
a file upload. Can be expressed as a number followed by a "K", "M", or
"G", which are interpreted to mean kilobytes, megabytes, or gigabytes,
respectively. [250M] (optional)]
for more information, see:
http://struts.apache.org/1.3.10/userGuide/configuration.html#struts-config

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with Struts 1 form

Posted by Anjib Mulepati <an...@hotmail.com>.
I have no clue where to check that for. Can u tell me which file?

Anjib
On 11/10/2010 10:13 AM, Dave Newton wrote:
> It can be either container upload limitation or the upload library
> (commons-fileupload) configuration. Or both.
>
> Dave
>
> On Wed, Nov 10, 2010 at 9:56 AM, Anjib Mulepati<an...@hotmail.com>  wrote:
>> I am writing file upload application in Struts 1.3.8. The problem I am
>> having is whenever I have file over 200MB to be upload application doesn't
>> work properly. I have couple of text field beside files upload and those
>> field value are shown null if I try to upload file over 200MB.
>>
>> JSP File
>> ----------
>> <html:form styleId="uploadForm" action="/upload"  focus="transactionName"
>> method="post" enctype="multipart/form-data">
>> <div id="errorPlace" style="font-weight: bold; color: #b80000;"
>> aria-labelledby="errors" aria-live="assertive"><html:errors /></div>
>> <label for="transactionName" class="formLabel"><bean:message
>> key="transfer.name"/></label>
>> <html:text title="Transaction Name" styleId="transactionName"
>> property="trans_name" tabindex="1" size="35" />
>> <br />
>>
>> <label for="recipientsName" class="formLabel"><bean:message
>> key="transfer.recipients"/></label>
>> <html:textarea title="Receipient Addresses" rows="2"
>> styleId="recipientsName" property="recpt_name" tabindex="2" cols="75" />
>> <br />
>>
>> <div id="fileSection" style="width: 345px">
>> <label for="upload_0" class="formLabel"><bean:message
>> key="transfer.upload"/></label>
>> <input title="File1" type="file" name="testFile[0]" id="upload_0"
>> tabindex="3" size="60" /><br />
>> <input title="File2" type="file" name="testFile[1]" id="upload_1"
>> tabindex="4" size="60"/><br>
>> <input title="File3" type="file" name="testFile[2]" id="upload_2"
>> tabindex="5" size="60"/><br>
>> <input title="File4" type="file" name="testFile[3]" id="upload_3"
>> tabindex="6" size="60"/><br>
>> </div>
>>
>> <input title="Upload File" id="submit"  type="submit" name="submit"
>> class="submitbutton" tabindex="8" value='<bean:message key="button.send" />'
>> /><br />
>> </html:form>
>>
>> ActionForm
>> ----------------
>> public class UploadForm extends org.apache.struts.action.ActionForm {
>>
>>     private String trans_name;
>>     private String recpt_name;
>>    private List testFile;
>>
>>     /**
>>      *
>>      */
>>     public UploadForm() {
>>         super();
>>         testFile = new ArrayList();
>>     }
>>
>>     public FormFile getTestFile(int i){
>>         return (testFile.size()>  i) ? (FormFile)testFile.get(i) : null;
>>     }
>>
>>     public List getList(){
>>         return testFile;
>>     }
>>
>>     public void setTestFile(int i, FormFile f){
>>         if(f.getFileSize()<= 0){
>>             f.destroy();
>>         }else{
>>             testFile.add(f);
>>         }
>>     }
>>
>>     public int getFileCount(){
>>         return testFile.size();
>>     }
>>
>>     public String getRecpt_name() {
>>         return recpt_name;
>>     }
>>
>>     public void setRecpt_name(String recpt_name) {
>>         this.recpt_name = recpt_name;
>>     }
>>
>>     public String getTrans_name() {
>>         return trans_name;
>>     }
>>
>>     public void setTrans_name(String trans_name) {
>>         this.trans_name = trans_name;
>>     }
>>
>>
>>
>>     /**
>>      * This is the action called from the Struts framework.
>>      * @param mapping The ActionMapping used to select this instance.
>>      * @param request The HTTP Request we are processing.
>>      * @return set of errors.
>>      */
>>     @Override
>>     public ActionErrors validate(ActionMapping mapping, HttpServletRequest
>> request) {
>>        ActionErrors errors = new ActionErrors();
>>         String transactionName = getTrans_name();             // HERE I AM
>> GETTING NULL IF FILE SIZE IS>  200MB
>>         String recipientName = getRecpt_name();                // FOR BOTH
>> transactionName and recipientName.
>>
>>         if(transactionName == null){
>>             errors.add("error", new ActionMessage("error.transactionName"));
>>         }
>>         if(recipientName == null){
>>             errors.add("error", new ActionMessage("error.recipientName"));
>>         }
>>         return errors;
>>     }
>> }
>>
>>
>> Any help will be appreciated.
>> Anjib
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem with Struts 1 form

Posted by Dave Newton <da...@gmail.com>.
It can be either container upload limitation or the upload library
(commons-fileupload) configuration. Or both.

Dave

On Wed, Nov 10, 2010 at 9:56 AM, Anjib Mulepati <an...@hotmail.com> wrote:
> I am writing file upload application in Struts 1.3.8. The problem I am
> having is whenever I have file over 200MB to be upload application doesn't
> work properly. I have couple of text field beside files upload and those
> field value are shown null if I try to upload file over 200MB.
>
> JSP File
> ----------
> <html:form styleId="uploadForm" action="/upload"  focus="transactionName"
> method="post" enctype="multipart/form-data" >
> <div id="errorPlace" style="font-weight: bold; color: #b80000;"
> aria-labelledby="errors" aria-live="assertive"><html:errors /></div>
> <label for="transactionName" class="formLabel"><bean:message
> key="transfer.name"/></label>
> <html:text title="Transaction Name" styleId="transactionName"
> property="trans_name" tabindex="1" size="35" />
> <br />
>
> <label for="recipientsName" class="formLabel"><bean:message
> key="transfer.recipients"/></label>
> <html:textarea title="Receipient Addresses" rows="2"
> styleId="recipientsName" property="recpt_name" tabindex="2" cols="75" />
> <br />
>
> <div id="fileSection" style="width: 345px" >
> <label for="upload_0" class="formLabel"><bean:message
> key="transfer.upload"/></label>
> <input title="File1" type="file" name="testFile[0]" id="upload_0"
> tabindex="3" size="60" /><br />
> <input title="File2" type="file" name="testFile[1]" id="upload_1"
> tabindex="4" size="60"/><br>
> <input title="File3" type="file" name="testFile[2]" id="upload_2"
> tabindex="5" size="60"/><br>
> <input title="File4" type="file" name="testFile[3]" id="upload_3"
> tabindex="6" size="60"/><br>
> </div>
>
> <input title="Upload File" id="submit"  type="submit" name="submit"
> class="submitbutton" tabindex="8" value='<bean:message key="button.send" />'
> /><br />
> </html:form>
>
> ActionForm
> ----------------
> public class UploadForm extends org.apache.struts.action.ActionForm {
>
>    private String trans_name;
>    private String recpt_name;
>   private List testFile;
>
>    /**
>     *
>     */
>    public UploadForm() {
>        super();
>        testFile = new ArrayList();
>    }
>
>    public FormFile getTestFile(int i){
>        return (testFile.size() > i) ? (FormFile)testFile.get(i) : null;
>    }
>
>    public List getList(){
>        return testFile;
>    }
>
>    public void setTestFile(int i, FormFile f){
>        if(f.getFileSize() <= 0){
>            f.destroy();
>        }else{
>            testFile.add(f);
>        }
>    }
>
>    public int getFileCount(){
>        return testFile.size();
>    }
>
>    public String getRecpt_name() {
>        return recpt_name;
>    }
>
>    public void setRecpt_name(String recpt_name) {
>        this.recpt_name = recpt_name;
>    }
>
>    public String getTrans_name() {
>        return trans_name;
>    }
>
>    public void setTrans_name(String trans_name) {
>        this.trans_name = trans_name;
>    }
>
>
>
>    /**
>     * This is the action called from the Struts framework.
>     * @param mapping The ActionMapping used to select this instance.
>     * @param request The HTTP Request we are processing.
>     * @return set of errors.
>     */
>    @Override
>    public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> request) {
>       ActionErrors errors = new ActionErrors();
>        String transactionName = getTrans_name();             // HERE I AM
> GETTING NULL IF FILE SIZE IS > 200MB
>        String recipientName = getRecpt_name();                // FOR BOTH
> transactionName and recipientName.
>
>        if(transactionName == null){
>            errors.add("error", new ActionMessage("error.transactionName"));
>        }
>        if(recipientName == null){
>            errors.add("error", new ActionMessage("error.recipientName"));
>        }
>        return errors;
>    }
> }
>
>
> Any help will be appreciated.
> Anjib
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org