Re: Managing file attachment

2008-12-02 Thread Shazad
Adam,
Once again. Thanks a lot for your reply. Really appreciate your help and
suggestion
while i still investigate to make it work :).

Regards
Shazad

On Mon, Dec 1, 2008 at 11:42 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:

>
> Instead of storing the file in the session, why don't you just store the
> file
> name and path.  If the user doesn't resubmit the request, then check for
> the
> file when the session expires and remove the file.  I agree storing the
> file
> itself is a bad idea, but a reference to the location should be fine.  You
> should prob. move the file to a temporary location.
>
> It has been too long since I've used struts1 to help you with the
> specifics,
> but I'm pretty sure there is nothing built in to deal with this scenario.
>
>
> Khawaja-Shahzad Butt wrote:
> >
> > Hi
> >
> > Adam,
> > Thanks for your reply, really appreciate it. I am using struts 1.3. The
> > validation is via validation.xml
> > and it kicks in
> > even before the action class can read the file, persistence is later
> step.
> >
> > The problem is if the do store the file in session in action class and
> > then
> > invoke manual
> > validation i.e. valid current form etc.
> >
> > *The session object will become huge. Then every time
> > i will have to store that file in session and then remove from session.
> >
> > Which doesn't seem a good approach in terms of performance.**. what do
> you
> > say?*
> >
> >
> > As far client side validation is concerned, the validtion.xml provides
> > powerful ways which
> > might be tough to do i.e. showing error messages etc... Also it will be
> > like
> > redoing
> > the work struts valdition framework has done.
> > *
> > Any other options???.*
> >
> > *
> > Can you guide me to custom the file interceptor any example of that. I
> > know
> > the default
> > destroys the file object as soon as the request has been sent?*
> >
> > *
> > Also is it possible i can get the path of the file like
> > 'c:\files\foobar.txt' and in case of
> > validation error messages read the file from that locaton ???*
> >
> > Please reply..
> >
> > Thanks again,
> >
> > Shazad
> >
> > On Mon, Dec 1, 2008 at 1:02 AM, Adam Ruggles <[EMAIL PROTECTED]>
> wrote:
> >
> >>
> >> I could be wrong but I believe you'd have to implement your own file
> >> upload
> >> interceptor and make sure the file is not removed after the execution of
> >> the
> >> action if a validation error occurs.  Then you'd need to re-associate
> >> that
> >> saved file when the next request occurs.  Also what happens if they
> never
> >> resubmit the request.  You will have a file sitting around.
> >>
> >> I can't think of a good way to handle that scenario since your not
> >> storing
> >> any information in the session or persistence layer and each request is
> >> really stateless.
> >>
> >> Adding client side validation might be your best bet.  That way the file
> >> isn't even submitted until the form passes validation.
> >>
> >>
> >> Khawaja-Shahzad Butt wrote:
> >> >
> >> > Hi,
> >> >
> >> > I am having an issue with struts file upload during validation. On the
> >> > page
> >> > when there's
> >> > a  validation error, the browsed/attached file drops. Does anyone
> >> > know a work around it, to have the previously attached file in tact,
> >> > meaning
> >> > if i have attached a file and hit submit and got the validation error,
> >> the
> >> > file should still be
> >> > there, so that i don't have reattach it again.
> >> >
> >> > Storing the file in session is out of league as it's not a good
> >> approach.
> >> >
> >> > Again my problem is if i attach a file and hit submit button and get
> >> > validation errors defined
> >> > in validation.xml, i fix the validation error and now i have re-attach
> >> > that
> >> > file again since it
> >> > gets detached.
> >> >
> >> > Please reply.
> >> >
> >> > Thanks
> >> > Thanks
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Managing-file-attachment-tp20762606p20766975.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]
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Managing-file-attachment-tp20762606p20774724.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: Managing file attachment

2008-12-01 Thread Adam Ruggles

Instead of storing the file in the session, why don't you just store the file
name and path.  If the user doesn't resubmit the request, then check for the
file when the session expires and remove the file.  I agree storing the file
itself is a bad idea, but a reference to the location should be fine.  You
should prob. move the file to a temporary location.

It has been too long since I've used struts1 to help you with the specifics,
but I'm pretty sure there is nothing built in to deal with this scenario.


Khawaja-Shahzad Butt wrote:
> 
> Hi
> 
> Adam,
> Thanks for your reply, really appreciate it. I am using struts 1.3. The
> validation is via validation.xml
> and it kicks in
> even before the action class can read the file, persistence is later step.
> 
> The problem is if the do store the file in session in action class and
> then
> invoke manual
> validation i.e. valid current form etc.
> 
> *The session object will become huge. Then every time
> i will have to store that file in session and then remove from session.
> 
> Which doesn't seem a good approach in terms of performance.**. what do you
> say?*
> 
> 
> As far client side validation is concerned, the validtion.xml provides
> powerful ways which
> might be tough to do i.e. showing error messages etc... Also it will be
> like
> redoing
> the work struts valdition framework has done.
> *
> Any other options???.*
> 
> *
> Can you guide me to custom the file interceptor any example of that. I
> know
> the default
> destroys the file object as soon as the request has been sent?*
> 
> *
> Also is it possible i can get the path of the file like
> 'c:\files\foobar.txt' and in case of
> validation error messages read the file from that locaton ???*
> 
> Please reply..
> 
> Thanks again,
> 
> Shazad
> 
> On Mon, Dec 1, 2008 at 1:02 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:
> 
>>
>> I could be wrong but I believe you'd have to implement your own file
>> upload
>> interceptor and make sure the file is not removed after the execution of
>> the
>> action if a validation error occurs.  Then you'd need to re-associate
>> that
>> saved file when the next request occurs.  Also what happens if they never
>> resubmit the request.  You will have a file sitting around.
>>
>> I can't think of a good way to handle that scenario since your not
>> storing
>> any information in the session or persistence layer and each request is
>> really stateless.
>>
>> Adding client side validation might be your best bet.  That way the file
>> isn't even submitted until the form passes validation.
>>
>>
>> Khawaja-Shahzad Butt wrote:
>> >
>> > Hi,
>> >
>> > I am having an issue with struts file upload during validation. On the
>> > page
>> > when there's
>> > a  validation error, the browsed/attached file drops. Does anyone
>> > know a work around it, to have the previously attached file in tact,
>> > meaning
>> > if i have attached a file and hit submit and got the validation error,
>> the
>> > file should still be
>> > there, so that i don't have reattach it again.
>> >
>> > Storing the file in session is out of league as it's not a good
>> approach.
>> >
>> > Again my problem is if i attach a file and hit submit button and get
>> > validation errors defined
>> > in validation.xml, i fix the validation error and now i have re-attach
>> > that
>> > file again since it
>> > gets detached.
>> >
>> > Please reply.
>> >
>> > Thanks
>> > Thanks
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Managing-file-attachment-tp20762606p20766975.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]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Managing-file-attachment-tp20762606p20774724.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: Managing file attachment

2008-12-01 Thread Shazad
Hi

Adam,
Thanks for your reply, really appreciate it. I am using struts 1.3. The
validation is via validation.xml
and it kicks in
even before the action class can read the file, persistence is later step.

The problem is if the do store the file in session in action class and then
invoke manual
validation i.e. valid current form etc.

*The session object will become huge. Then every time
i will have to store that file in session and then remove from session.

Which doesn't seem a good approach in terms of performance.**. what do you
say?*


As far client side validation is concerned, the validtion.xml provides
powerful ways which
might be tough to do i.e. showing error messages etc... Also it will be like
redoing
the work struts valdition framework has done.
*
Any other options???.*

*
Can you guide me to custom the file interceptor any example of that. I know
the default
destroys the file object as soon as the request has been sent?*

*
Also is it possible i can get the path of the file like
'c:\files\foobar.txt' and in case of
validation error messages read the file from that locaton ???*

Please reply..

Thanks again,

Shazad

On Mon, Dec 1, 2008 at 1:02 AM, Adam Ruggles <[EMAIL PROTECTED]> wrote:

>
> I could be wrong but I believe you'd have to implement your own file upload
> interceptor and make sure the file is not removed after the execution of
> the
> action if a validation error occurs.  Then you'd need to re-associate that
> saved file when the next request occurs.  Also what happens if they never
> resubmit the request.  You will have a file sitting around.
>
> I can't think of a good way to handle that scenario since your not storing
> any information in the session or persistence layer and each request is
> really stateless.
>
> Adding client side validation might be your best bet.  That way the file
> isn't even submitted until the form passes validation.
>
>
> Khawaja-Shahzad Butt wrote:
> >
> > Hi,
> >
> > I am having an issue with struts file upload during validation. On the
> > page
> > when there's
> > a  validation error, the browsed/attached file drops. Does anyone
> > know a work around it, to have the previously attached file in tact,
> > meaning
> > if i have attached a file and hit submit and got the validation error,
> the
> > file should still be
> > there, so that i don't have reattach it again.
> >
> > Storing the file in session is out of league as it's not a good approach.
> >
> > Again my problem is if i attach a file and hit submit button and get
> > validation errors defined
> > in validation.xml, i fix the validation error and now i have re-attach
> > that
> > file again since it
> > gets detached.
> >
> > Please reply.
> >
> > Thanks
> > Thanks
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Managing-file-attachment-tp20762606p20766975.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: Managing file attachment

2008-11-30 Thread Adam Ruggles

I could be wrong but I believe you'd have to implement your own file upload
interceptor and make sure the file is not removed after the execution of the
action if a validation error occurs.  Then you'd need to re-associate that
saved file when the next request occurs.  Also what happens if they never
resubmit the request.  You will have a file sitting around.

I can't think of a good way to handle that scenario since your not storing
any information in the session or persistence layer and each request is
really stateless.

Adding client side validation might be your best bet.  That way the file
isn't even submitted until the form passes validation.


Khawaja-Shahzad Butt wrote:
> 
> Hi,
> 
> I am having an issue with struts file upload during validation. On the
> page
> when there's
> a  validation error, the browsed/attached file drops. Does anyone
> know a work around it, to have the previously attached file in tact,
> meaning
> if i have attached a file and hit submit and got the validation error, the
> file should still be
> there, so that i don't have reattach it again.
> 
> Storing the file in session is out of league as it's not a good approach.
> 
> Again my problem is if i attach a file and hit submit button and get
> validation errors defined
> in validation.xml, i fix the validation error and now i have re-attach
> that
> file again since it
> gets detached.
> 
> Please reply.
> 
> Thanks
> Thanks
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Managing-file-attachment-tp20762606p20766975.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]



Managing file attachment in struts.....please reply..

2008-11-30 Thread Shazad
Hi,

I am having an issue with struts file upload during validation. On the page
when there's
a  validation error, the browsed/attached file drops. Does anyone
know a work around it, to have the previously attached file in tact, meaning
if i have attached a file and hit submit and got the validation error, the
file should still be
there, so that i don't have reattach it again.

Storing the file in session is out of league as it's not a good approach.

Again my problem is if i attach a file and hit submit button and get
validation errors defined
in validation.xml, i fix the validation error and now i have re-attach that
file again since it
gets detached.

Please reply.

Thanks


Managing file attachment

2008-11-30 Thread Shazad
Hi,

I am having an issue with struts file upload during validation. On the page
when there's
a  validation error, the browsed/attached file drops. Does anyone
know a work around it, to have the previously attached file in tact, meaning
if i have attached a file and hit submit and got the validation error, the
file should still be
there, so that i don't have reattach it again.

Storing the file in session is out of league as it's not a good approach.

Again my problem is if i attach a file and hit submit button and get
validation errors defined
in validation.xml, i fix the validation error and now i have re-attach that
file again since it
gets detached.

Please reply.

Thanks
Thanks