wood burning stoves 2.0*
The moose likes Struts and the fly likes Get the jsp content from a struts action in OC4J Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Get the jsp content from a struts action in OC4J" Watch "Get the jsp content from a struts action in OC4J" New topic
Author

Get the jsp content from a struts action in OC4J

menon sandeep
Greenhorn

Joined: Nov 02, 2012
Posts: 10
I am using struts 1.2 with OC4j container. For printing purpose i need to get the content of a jsp file generated from a struts action in a normal java class. For that i am passing the request and response object to the generate method in the java class. I hope that by overriding the getWriter() method we can achieve the functionality.


But although the action is processed, the content is always empty. Please advice
menon sandeep
Greenhorn

Joined: Nov 02, 2012
Posts: 10
Any One please
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

Please Be Patient. We are all volunteers here, answering questions in our spare time.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
menon sandeep
Greenhorn

Joined: Nov 02, 2012
Posts: 10
I tried to get the content using HTTPClient

But still no luck as the temp variable only contains the html content for the login page although i am setting the state
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

Are you trying to do this within an Action or a stand-alone Java program? If you are on the server side, HttpServletResponseWrapper makes sense. If you are on the client side, HttpClient makes sense.
menon sandeep
Greenhorn

Joined: Nov 02, 2012
Posts: 10
Many thanks for the reply. I am trying to do this from the server side. So i think HttpServletResponseWrapper is the correct choice
I have gone through the suggestions in the below thread which more or less matches with my requirement
http://stackoverflow.com/questions/1963158/capture-generated-dynamic-content-at-server-side
Is there any other way we can achieve the objective?
menon sandeep
Greenhorn

Joined: Nov 02, 2012
Posts: 10
In the filter pattern whenever a servlet with a particular url pattern is accessed, it can process the content of the resultant jsp.
Is there any other way we can invoke a servlet from a struts 1 action without using the requestDispatcher object as it includes the wrapped response also with the final result?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

I've what you are trying to do with HttpServletResponseWrapper, though the example I have handy has a bunch of other requirements that obfuscate the solution. One difference I see is that I used RequestDispatcher.forward rather than include.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get the jsp content from a struts action in OC4J