Re: Struts 2 file upload size validation

2008-05-09 Thread Rubbinio


mgainty wrote:
> 
> 2.0.11 FileUploadIntereptor.java
> 
> ActionContext ac = invocation.getInvocationContext();
> HttpServletRequest request = (HttpServletRequest) 
> ac.get(ServletActionContext.HTTP_REQUEST);
> HashMap map = request.getParameterMap();
> //for further information take a look at
> http://www.docjar.com/docs/api/javax/servlet/ServletRequest.html#getParameterMap
> 
> 

Tried that and it works as long as the file size validation does not fail in
the interceptor. If it fails the parameter map is empty. Any other ideas.

-- 
View this message in context: 
http://www.nabble.com/Struts-2-file-upload-size-validation-tp17112411p17146914.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 2 file upload size validation

2008-05-08 Thread Rubbinio

Yes if the file size is OK everything is fine. At first we used the default
stack. Then we took the default and modified it by moving the
fileUploadInterceptor below the params interceptor so it would look
something like this:


interceptor-stack name="ourUploadStack"

interceptor-ref name="exception"

interceptor-ref name="alias"

interceptor-ref name="servletConfig"

interceptor-ref name="prepare"

interceptor-ref name="i18n"

interceptor-ref name="chain"

interceptor-ref name="debugging"

interceptor-ref name="profiling"

interceptor-ref name="scopedModelDriven"

interceptor-ref name="modelDriven"

interceptor-ref name="checkbox"

interceptor-ref name="staticParams"

interceptor-ref name="params"

  param name="excludeParams"dojo\..*param

interceptor-ref

interceptor-ref name="conversionError"

interceptor-ref name="fileUpload"

interceptor-ref name="validation"

param name="excludeMethods"input,back,cancel,browseparam

interceptor-ref

interceptor-ref name="workflow"

param name="excludeMethods"input,back,cancel,browseparam

interceptor-ref

interceptor-stack



Thanks
R



Laurie Harper wrote:
> 
> Rubbinio wrote:
>> Hi,
>> 
>> we are trying to use file upload in Struts 2 and run into the following
>> problem.
>> 
>> We have a form with multiple fields among which one is a file input
>> field.
>> The user must complete the form and then select a file to upload. If the
>> file size is larger than what we specify in the struts.properties the
>> FileUploadInterceptor validates and adds the error. Up to here everything
>> is
>> fine however upon having the error passed to the action we want to return
>> to
>> the same form, display the error and have the rest of fields populated
>> with
>> the values the user has inputed (except the file field).
>> 
>> The problem is that when we get in the action (validate method) none of
>> the
>> request parameters (form values) are populated. Everything is empty.
>> 
>> The question is why is this happening and how can we have the form values
>> populated in the action so that we can display the page correctly ?
> 
> What interceptor stack are you using? Does everything work as expected 
> if the file size does not exceed the size you specify?
> 
> L.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-file-upload-size-validation-tp17112411p17125070.html
Sent from the Struts - User mailing list archive at Nabble.com.


Re: Struts 2 file upload size validation

2008-05-07 Thread Laurie Harper

The OP wrote:
>> we are trying to use file upload in Struts 2...

Martin wrote:

Struts 1.2.9


Doh!


org.apache.struts.chain.servlet.validateActionForm
where the validate method is declared as

protected ActionErrors validate(Context context,
   ActionConfig actionConfig,
   ActionForm actionForm)
//reference the actionForm for access to the form attributes

2.0.11 FileUploadIntereptor.java

ActionContext ac = invocation.getInvocationContext();
HttpServletRequest request = (HttpServletRequest) 
ac.get(ServletActionContext.HTTP_REQUEST);

HashMap map = request.getParameterMap();
//for further information take a look at
http://www.docjar.com/docs/api/javax/servlet/ServletRequest.html#getParameterMap 



HTH
M
- Original Message - From: "Rubbinio" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, May 07, 2008 3:24 PM
Subject: Struts 2 file upload size validation




Hi,

we are trying to use file upload in Struts 2 and run into the following
problem.

We have a form with multiple fields among which one is a file input 
field.

The user must complete the form and then select a file to upload. If the
file size is larger than what we specify in the struts.properties the
FileUploadInterceptor validates and adds the error. Up to here 
everything is
fine however upon having the error passed to the action we want to 
return to
the same form, display the error and have the rest of fields populated 
with

the values the user has inputed (except the file field).

The problem is that when we get in the action (validate method) none 
of the

request parameters (form values) are populated. Everything is empty.

The question is why is this happening and how can we have the form values
populated in the action so that we can display the page correctly ?

Thanks
--
View this message in context: 
http://www.nabble.com/Struts-2-file-upload-size-validation-tp17112411p17112411.html 


Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 2 file upload size validation

2008-05-07 Thread Laurie Harper

Rubbinio wrote:

Hi,

we are trying to use file upload in Struts 2 and run into the following
problem.

We have a form with multiple fields among which one is a file input field.
The user must complete the form and then select a file to upload. If the
file size is larger than what we specify in the struts.properties the
FileUploadInterceptor validates and adds the error. Up to here everything is
fine however upon having the error passed to the action we want to return to
the same form, display the error and have the rest of fields populated with
the values the user has inputed (except the file field).

The problem is that when we get in the action (validate method) none of the
request parameters (form values) are populated. Everything is empty.

The question is why is this happening and how can we have the form values
populated in the action so that we can display the page correctly ?


What interceptor stack are you using? Does everything work as expected 
if the file size does not exceed the size you specify?


L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 2 file upload size validation

2008-05-07 Thread Martin

Struts 1.2.9
org.apache.struts.chain.servlet.validateActionForm
where the validate method is declared as

protected ActionErrors validate(Context context,
   ActionConfig actionConfig,
   ActionForm actionForm)
//reference the actionForm for access to the form attributes

2.0.11 FileUploadIntereptor.java

ActionContext ac = invocation.getInvocationContext();
HttpServletRequest request = (HttpServletRequest) 
ac.get(ServletActionContext.HTTP_REQUEST);

HashMap map = request.getParameterMap();
//for further information take a look at
http://www.docjar.com/docs/api/javax/servlet/ServletRequest.html#getParameterMap

HTH
M
- Original Message - 
From: "Rubbinio" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, May 07, 2008 3:24 PM
Subject: Struts 2 file upload size validation




Hi,

we are trying to use file upload in Struts 2 and run into the following
problem.

We have a form with multiple fields among which one is a file input field.
The user must complete the form and then select a file to upload. If the
file size is larger than what we specify in the struts.properties the
FileUploadInterceptor validates and adds the error. Up to here everything 
is
fine however upon having the error passed to the action we want to return 
to
the same form, display the error and have the rest of fields populated 
with

the values the user has inputed (except the file field).

The problem is that when we get in the action (validate method) none of 
the

request parameters (form values) are populated. Everything is empty.

The question is why is this happening and how can we have the form values
populated in the action so that we can display the page correctly ?

Thanks
--
View this message in context: 
http://www.nabble.com/Struts-2-file-upload-size-validation-tp17112411p17112411.html

Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 2 file upload size validation

2008-05-07 Thread Rubbinio

Hi,

we are trying to use file upload in Struts 2 and run into the following
problem.

We have a form with multiple fields among which one is a file input field.
The user must complete the form and then select a file to upload. If the
file size is larger than what we specify in the struts.properties the
FileUploadInterceptor validates and adds the error. Up to here everything is
fine however upon having the error passed to the action we want to return to
the same form, display the error and have the rest of fields populated with
the values the user has inputed (except the file field).

The problem is that when we get in the action (validate method) none of the
request parameters (form values) are populated. Everything is empty.

The question is why is this happening and how can we have the form values
populated in the action so that we can display the page correctly ?

Thanks
-- 
View this message in context: 
http://www.nabble.com/Struts-2-file-upload-size-validation-tp17112411p17112411.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]