struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazad <kshahzadb...@gmail.com>
Subject Re: Managing file attachment
Date Mon, 01 Dec 2008 09:46:11 GMT
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 <a.ruggles@gmail.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message