This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

downloading a File in Struts 2

 
Neeraj jain
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to download a file with Struts2 but when i click on the hyperlink to download the file i am getting
No result defined for action com.mkyong.common.action.DownloadAction and result success

here is the code
struts.xml


downloadPage.jsp



DownloadAction




Anyone please help me why the file isn't downloading
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have missed mapping "download" action in struts.xml file.
Hence it isn't able to download it. Hope this helps.

Thanks,
Ashwini Kashyap | www.infocepts.com
 
Neeraj jain
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks bro but i am returning success from execute method so why i have to do the mapping of download
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am returning success from execute method so why i have to do the mapping of download


Success will get executed only when your "download" action class will get called and you haven't mapped that action and hence it wont go into your class and execute further.

Your code should be like -

<action name="download" class=".....">
<result name="success" type="stream">
.......

instead of
<action name="success" class=".....">
<result name="success" type="stream">
.......


Regards,
Ashwini
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic