File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes help plz Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "help plz" Watch "help plz" New topic

help plz

Ranch Hand

Joined: Apr 01, 2005
Posts: 431
Hi ranchers

Please help me out in solving this problem. I have a situation like this. I need to show a login page whenever the user logs-in, in the mean time I need to get all his data in a backend process. Once the data acquisition process is completed, i need to forward him to another JSP page which can show the data. I am able to do this in usual Servlet, JSP architecture with some automatic refresh mechanisms. Since I could not access the response's outputstream inside an Action class, I am very much confused of how to do this in Struts.

Is there anyone who already faced a situation like this. Any solutions?

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
You could use a delayed meta-refresh in the browser's html.
SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Your assertion that you can't get the response's output stream from an action class is incorrect. Since the response is passed into the execute() method as a parameter, you can access it's outputStream property. The important thing to remember is that since you're handing the response in your action class, you need to let Struts know that no forwarding is necessary by returning null from the execute() method, rather than an ActionForward.

In the sample code that come with Struts 1.2, there is an example of doing this. Look in struts-examples.war for org.apache.struts.webapp.exercise.ImageAction.

Consultant, Sima Solutions
I agree. Here's the link:
subject: help plz
It's not a secret anymore!