Re: problem with file upload

2015-09-11 Thread Johannes Geppert
Does it not work with the point notation? Not sur if this works when you
are working with list of object.



Best Regards

Johannes

#
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep


2015-09-11 11:38 GMT+02:00 Yaragalla Muralidhar :

> That is what i am saying. The docs shows how to upload files to action
> class but my requirement is different. Please read the problem carefully.
> and do help me.
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ *
>
> On Fri, Sep 11, 2015 at 3:03 PM, Johannes Geppert 
> wrote:
>
> > Have you already checked the docs?
> > https://struts.apache.org/docs/file-upload.html
> >
> >
> > Best Regards
> >
> > Johannes
> >
> > #
> > web: http://www.jgeppert.com
> > twitter: http://twitter.com/jogep
> >
> >
> > 2015-09-11 11:31 GMT+02:00 Yaragalla Muralidhar <
> yaragallamur...@gmail.com
> > >:
> >
> > > Hi ,
> > >   I know how to upload a file into the action class but my requirement
> is
> > > different. I have a list of pojos where each pojo contains a field
> called
> > > file.
> > >
> > > for example:-
> > >
> > > public class Pojo{
> > >
> > > private int pk;
> > > private File file;
> > >
> > >//setters and getters
> > > }
> > >
> > > In my action class:-
> > >
> > > public class MyAction{
> > >
> > >private List pojos;
> > >//setter getter
> > > }
> > >
> > > from my jsp when i select a file and say upload it has to set to the
> Pojo
> > > "file" property. how do i do that? I have complete idea of how to
> upload
> > > directly to the action class but now it is different. the file has to
> go
> > > and sit in the Pojo class file property. How can i do this? Please help
> > me?
> > >
> > >
> > >
> > > *Thanks and Regards,*
> > > Muralidhar Yaragalla.
> > >
> > > *http://yaragalla.blogspot.in/ *
> > >
> >
>


Re: problem with file upload

2015-09-11 Thread Yaragalla Muralidhar
That is what i am saying. The docs shows how to upload files to action
class but my requirement is different. Please read the problem carefully.
and do help me.

*Thanks and Regards,*
Muralidhar Yaragalla.

*http://yaragalla.blogspot.in/ *

On Fri, Sep 11, 2015 at 3:03 PM, Johannes Geppert  wrote:

> Have you already checked the docs?
> https://struts.apache.org/docs/file-upload.html
>
>
> Best Regards
>
> Johannes
>
> #
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
>
>
> 2015-09-11 11:31 GMT+02:00 Yaragalla Muralidhar  >:
>
> > Hi ,
> >   I know how to upload a file into the action class but my requirement is
> > different. I have a list of pojos where each pojo contains a field called
> > file.
> >
> > for example:-
> >
> > public class Pojo{
> >
> > private int pk;
> > private File file;
> >
> >//setters and getters
> > }
> >
> > In my action class:-
> >
> > public class MyAction{
> >
> >private List pojos;
> >//setter getter
> > }
> >
> > from my jsp when i select a file and say upload it has to set to the Pojo
> > "file" property. how do i do that? I have complete idea of how to upload
> > directly to the action class but now it is different. the file has to go
> > and sit in the Pojo class file property. How can i do this? Please help
> me?
> >
> >
> >
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ *
> >
>


Re: problem with file upload

2015-09-11 Thread Johannes Geppert
Have you already checked the docs?
https://struts.apache.org/docs/file-upload.html


Best Regards

Johannes

#
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep


2015-09-11 11:31 GMT+02:00 Yaragalla Muralidhar :

> Hi ,
>   I know how to upload a file into the action class but my requirement is
> different. I have a list of pojos where each pojo contains a field called
> file.
>
> for example:-
>
> public class Pojo{
>
> private int pk;
> private File file;
>
>//setters and getters
> }
>
> In my action class:-
>
> public class MyAction{
>
>private List pojos;
>//setter getter
> }
>
> from my jsp when i select a file and say upload it has to set to the Pojo
> "file" property. how do i do that? I have complete idea of how to upload
> directly to the action class but now it is different. the file has to go
> and sit in the Pojo class file property. How can i do this? Please help me?
>
>
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ *
>


Re: problem with file upload

2015-09-11 Thread Yaragalla Muralidhar
Hi Johannes,
 it worked. thank u so much.

*Thanks and Regards,*
Muralidhar Yaragalla.

*http://yaragalla.blogspot.in/ *

On Fri, Sep 11, 2015 at 3:12 PM, Johannes Geppert  wrote:

> Does it not work with the point notation? Not sur if this works when you
> are working with list of object.
>
> 
>
> Best Regards
>
> Johannes
>
> #
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
>
>
> 2015-09-11 11:38 GMT+02:00 Yaragalla Muralidhar  >:
>
> > That is what i am saying. The docs shows how to upload files to action
> > class but my requirement is different. Please read the problem carefully.
> > and do help me.
> >
> > *Thanks and Regards,*
> > Muralidhar Yaragalla.
> >
> > *http://yaragalla.blogspot.in/ *
> >
> > On Fri, Sep 11, 2015 at 3:03 PM, Johannes Geppert 
> > wrote:
> >
> > > Have you already checked the docs?
> > > https://struts.apache.org/docs/file-upload.html
> > >
> > >
> > > Best Regards
> > >
> > > Johannes
> > >
> > > #
> > > web: http://www.jgeppert.com
> > > twitter: http://twitter.com/jogep
> > >
> > >
> > > 2015-09-11 11:31 GMT+02:00 Yaragalla Muralidhar <
> > yaragallamur...@gmail.com
> > > >:
> > >
> > > > Hi ,
> > > >   I know how to upload a file into the action class but my
> requirement
> > is
> > > > different. I have a list of pojos where each pojo contains a field
> > called
> > > > file.
> > > >
> > > > for example:-
> > > >
> > > > public class Pojo{
> > > >
> > > > private int pk;
> > > > private File file;
> > > >
> > > >//setters and getters
> > > > }
> > > >
> > > > In my action class:-
> > > >
> > > > public class MyAction{
> > > >
> > > >private List pojos;
> > > >//setter getter
> > > > }
> > > >
> > > > from my jsp when i select a file and say upload it has to set to the
> > Pojo
> > > > "file" property. how do i do that? I have complete idea of how to
> > upload
> > > > directly to the action class but now it is different. the file has to
> > go
> > > > and sit in the Pojo class file property. How can i do this? Please
> help
> > > me?
> > > >
> > > >
> > > >
> > > > *Thanks and Regards,*
> > > > Muralidhar Yaragalla.
> > > >
> > > > *http://yaragalla.blogspot.in/ *
> > > >
> > >
> >
>


Re: problem in file upload

2008-04-09 Thread Jeromy Evans

Rajeev Sharma wrote:


When I try to upload a file which is bigger then the max allowed size,
the file upload interceptor returns input and the control does not
come to the execute method of my action class. In this case I can
redirect the result to some JSP, to some other action etc, but how do I
return a xml response with the error description and some error code. 

  

Hi Rajeev,

It sounds like you just want an action to return an XML result (for an 
input result).

A very simple way to do that is return a JSP with contentType=text/xml.

in struts.xml:
 result name=inputfailed.jsp/result
in the failed.jsp:

%@ page contentType=text/xml;charset=ISO-8859-1 %
?xml version=1.0 encoding=ISO-8859-1?
messageToo big!/message


You can use properties in your XML as you would with a JSP result.  

There's also an XSLT result type available or you could use a Bean-XML 
serializer like XStream.


Hope that helps,
Jeromy Evans


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



Re: problem in file upload

2008-04-09 Thread Rajeev Sharma
Hi Jeromy,

Thanks for the help. I tried to do the same thing with an xml file.
Instead of using failed.jsp, I returned an xml file failed.xml with some
hard coded error message and error code.

What if the file upload interceptor returned input for some other
reason? I would be returning the error code and message which says the
file is too large. How would I create the error message and code
dynamically depending on the actual error?

Rajeev

On Wed, 2008-04-09 at 22:22 +1000, Jeromy Evans wrote:
 Rajeev Sharma wrote:
 
  When I try to upload a file which is bigger then the max allowed size,
  the file upload interceptor returns input and the control does not
  come to the execute method of my action class. In this case I can
  redirect the result to some JSP, to some other action etc, but how do I
  return a xml response with the error description and some error code. 
 

 Hi Rajeev,
 
 It sounds like you just want an action to return an XML result (for an 
 input result).
 A very simple way to do that is return a JSP with contentType=text/xml.
 
 in struts.xml:
   result name=inputfailed.jsp/result
  in the failed.jsp:
 
 %@ page contentType=text/xml;charset=ISO-8859-1 %
 ?xml version=1.0 encoding=ISO-8859-1?
 messageToo big!/message
 
 
 You can use properties in your XML as you would with a JSP result.  
 
 There's also an XSLT result type available or you could use a Bean-XML 
 serializer like XStream.
 
 Hope that helps,
  Jeromy Evans
 
 
 -
 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: problem in file upload

2008-04-09 Thread Martin Gainty
If you dont mind using freemarker you can always use
exception-interceptor.html
http://struts.apache.org/2.x/docs/exception-interceptor.html

M--
- Original Message -
From: Rajeev Sharma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, April 09, 2008 1:59 PM
Subject: Re: problem in file upload


 Hi Jeromy,

 Thanks for the help. I tried to do the same thing with an xml file.
 Instead of using failed.jsp, I returned an xml file failed.xml with some
 hard coded error message and error code.

 What if the file upload interceptor returned input for some other
 reason? I would be returning the error code and message which says the
 file is too large. How would I create the error message and code
 dynamically depending on the actual error?

 Rajeev

 On Wed, 2008-04-09 at 22:22 +1000, Jeromy Evans wrote:
  Rajeev Sharma wrote:
  
   When I try to upload a file which is bigger then the max allowed size,
   the file upload interceptor returns input and the control does not
   come to the execute method of my action class. In this case I can
   redirect the result to some JSP, to some other action etc, but how do
I
   return a xml response with the error description and some error code.
  
  
  Hi Rajeev,
 
  It sounds like you just want an action to return an XML result (for an
  input result).
  A very simple way to do that is return a JSP with
contentType=text/xml.
 
  in struts.xml:
result name=inputfailed.jsp/result
   in the failed.jsp:
 
  %@ page contentType=text/xml;charset=ISO-8859-1 %
  ?xml version=1.0 encoding=ISO-8859-1?
  messageToo big!/message
 
 
  You can use properties in your XML as you would with a JSP result.
 
  There's also an XSLT result type available or you could use a Bean-XML
  serializer like XStream.
 
  Hope that helps,
   Jeromy Evans
 
 
  -
  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]




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



Re: Problem with file upload in struts2

2007-04-16 Thread Dave Newton
--- Mahdi Milani Fard [EMAIL PROTECTED] wrote:
 I'm trying to upload a file with struts2 [...]

Try including the action context cleanup filter as the
first filter in your web.xml. If that fixes it for you
as well I'll add something to the upload wiki docs, so
please follow up.

filter
  filter-namestruts-cleanup/filter-name
  filter-class
org.apache.struts2.dispatcher.ActionContextCleanUp
  /filter-class
/filter

d.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Problem with file upload in struts2

2007-04-16 Thread Mahdi Milani Fard

That solved the problem. I also had some problem with url objects in jsps.
Sometimes they did not include the params I indicated. That was also solved
with the cleanup filter.


Dave Newton-4 wrote:
 
 --- Mahdi Milani Fard [EMAIL PROTECTED] wrote:
 I'm trying to upload a file with struts2 [...]
 
 Try including the action context cleanup filter as the
 first filter in your web.xml. If that fixes it for you
 as well I'll add something to the upload wiki docs, so
 please follow up.
 
 filter
   filter-namestruts-cleanup/filter-name
   filter-class
 org.apache.struts2.dispatcher.ActionContextCleanUp
   /filter-class
 /filter
 
 d.
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-file-upload-in-struts2-tf3584102.html#a10017784
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: Problem with file upload in struts2

2007-04-16 Thread Eric Rank

I had the same problem with file uploads using Struts 2.0.6

I tracked down the source of this problem. To summarize, it's a bug  
that's specific to the Struts 2.0.6 tag; it has since been fixed in  
the repository. The class in question is the FilterDispatcher. In  
short when uploading a file, the request object needs to be wrapped  
by the MultiPartRequestWrapper, but it doesn't always happen, because  
of a flaw in the logic.


Experimenting with the context cleanup filter has proven successful,  
although I haven't tested thoroughly with that solution. The solution  
I've chosen to use is fixing the FilterDispatcher bug in my source.


I have more details in a blog post here:  http://blog.lo-fi.net/ 
2007/04/i-know-why-struts-2-file-upload-fails.html


I hope this helps put this issue to rest,

Eric Rank


On Apr 16, 2007, at 6:45 AM, Dave Newton wrote:


--- Mahdi Milani Fard [EMAIL PROTECTED] wrote:

I'm trying to upload a file with struts2 [...]


Try including the action context cleanup filter as the
first filter in your web.xml. If that fixes it for you
as well I'll add something to the upload wiki docs, so
please follow up.

filter
  filter-namestruts-cleanup/filter-name
  filter-class
org.apache.struts2.dispatcher.ActionContextCleanUp
  /filter-class
/filter

d.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.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: problem with file upload when validator error happens

2004-08-06 Thread Emmanouil Batsis
Jade Yaqiong Fang wrote:
I have the problem with the file upload validation
Exactly the same situation with v1.2.
Cheers,
Manos
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: problem with file upload when validator error happens

2004-08-06 Thread Jade Yaqiong Fang

--- Emmanouil Batsis [EMAIL PROTECTED]
wrote:

 Jade Yaqiong Fang wrote:
 
 I have the problem with the file upload validation
error. Actually I can upload files correctly within
the file size limit. but the behavior changes weird
when I got the file upload size up limit error.
For example: I set up 4M as the limit size,
With a 3M file it works fine.
With a 5M file I get errors on logs but upload goes on
in the browser, and it just goes forever, I will wait
longlong time and nothing refreshed , long time later,
it might just get a time out error. 

If i set the size-limit to 10M, 5M upload works well
in less than a seconds, but a 
11M upload takes forever again. I get file-size error
logs in the first request seconds,and I get all the
log info for the new jsp page preparation, I just
never saw that new jsp page displayed in my
browser
and I change the size limit to higher, as long as
within the file size limit, it works fine, and if I
upload a file above the size limit, i can get the file
size error log, but never get the next jsp page come
back. Actually, I take back my words, if I config
struts-config.xml to sth simple jsp page without form,
it works and display the error msg, however, if the
forward page contains multipart/form-data enctype, the
browser just hang on forever.
I am using struts 1.1, and tomcat 5.0.27.  I tried the
example, and also has the validator problem. I am so
lost now...Please help! Thanks.

 
 Exactly the same situation with v1.2.
 
 Cheers,
 
 Manos
 


So How can I avoid it? I definitely will have a lot of
file upload in many jsp pages, and need them to be
validated . Is there any way to turn around? Thanks.





__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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