• Post Reply Bookmark Topic Watch Topic
  • New Topic

run jsp without sending the response

 
Mike Phillip
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Here is my problem,

I have a servlet that recieves a request but I don't need to send the response back to the user, I need only to print in the console what would be the response, in this case a simple html code.

the thing is, to print this html I'm using something like System.out.ptintln("<html><head><titlte>title</title></head></html">");

it is working fine for what I want, but my html is not that simple, it's a big one and it's very hard to write the html using System.out.println


So I thought using a jsp to generate the code, and then print the result, but I don't know how to use call the jsp without returning the response, like a request dispath forward


I needed something like:

myservlet method {

String htmltoprint = callmyjsp
System.out.print(htmltoprint);


}

how can I call the jsp and print it, without sending back?

thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't fathom why you'd want to do this, but consider using something other than JSP--like FreeMarker or Velocity. They're template languages that are easier (IMO) to use independently of a server. In this scenario you'd just evaluate the template from your servlet and dump the output to the console.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!