File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Action

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Struts Action. From which i want to use like

out.println(HTML PAGE);

Basically, from Struts Action, the output should be generated without going to Struts-Config.

In a regular servlet, it can be achieved using out.println statements. Please help.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to write directly to the response.

I'm not sure why you'd want to do that, though, and I'm not sure what you mean by "without going to Struts-Config".
 
Aditya Keyal
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get the response write or output stream using the or . Then you can very simply use the response object to write whatever data you want to.

As for your problem of
without going to Struts-Config
what I think you mean is not get forwarded to a particular JSP or Action (for ex. if you want to stream back an excel/pdf file) . What you need to do is return a object. This way it will not "Go to the Struts-Config"
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or just return null.
 
Aditya Keyal
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats right David. Even a null will do. Thanks for pointing it out.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic