tags:

views:

29

answers:

2

I have large JSP page, and there is XML creation on it.

For debug purpose i need to write that XML to console.

What is the easiest way to do this from JSP?

thank you very much on your time and energy, best regards

EXAMPLE:

...

My.jsp

...
    <portfolio>
      <stock>
        <symbol><c:out value="${bean.prop1}"/></symbol>
        <name><c:out value="${bean.prop2}"/></name>
        <price><c:out value="${bean.prop3}"/></price>
      </stock>
    </portfolio>
...

....

Now i want to print entire XML to console to see if it is OK

+2  A: 

You can't do this from the JSP on. Your best bet is to create a Filter which wraps the response using HttpServletResponseWrapper wherein you copy the response output. Finally log the captured response output. Long story short, here's a code example: Capture and log the response body.

If you want to log partial response, you've to parse the captured output yourself.

BalusC
A: 

thank you very much!

reg
Hi, this is actually not an answer :) The normal way to express thanks is to upvote the helpful answer and if necessary post a comment by `add comment` link below the answer :)
BalusC