• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Get the jsp content from a struts action in OC4J

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any One please
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Be Patient. We are all volunteers here, answering questions in our spare time.
 
menon sandeep
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic