Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rendering JSP into dummy response to obtain HTML

843838May 31 2007 — edited Jun 1 2007
Is it possible to render a JSP into a mock response?

A project I'm working on requires me to render a series of small JSPs that are currently being included into a parent JSP. I would like to be able to render each individually, and then store the resulting String from the response for later use. I don't want to actually affect the real httpservletresponse at this time, just obtain the String from the JSP, store it, and throw away the response.

Is there an api besides requestdispatcher.forward() and .include() that can be used?

I tried creating a simple implementation of httpservletresponse, but it actually crashed my tomcat when I tried to pass that to the requestdispatcher.

I'm thinking about trying the mocks provided by spring, but I'm not crazy about the idea of having 'test' code within a running application ( I guess you don't have to look at it that way though).

Someone please tell me if I'm trying to do something impossible here:)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2007
Added on May 31 2007
5 comments
528 views