aspose file tools*
The moose likes Struts and the fly likes Struts Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Action" Watch "Struts Action" New topic
Author

Struts Action

Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
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.


$Hi/\bEr
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Dec 01, 2008
Posts: 71
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"


- Aditya Webservices Blog
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Or just return null.
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
Thats right David. Even a null will do. Thanks for pointing it out.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts Action
 
Similar Threads
Struts latest stable version
Problem regarding Struts with ajax
send variable value from one servlet to another servlet for itext pdf
How to Download XML file from database?
Basic Bean Doubt