Hello!

I've been googling a while now without success so i thought i might ask
you. I'm trying to get the HTML of a WebMarkupContainer. That is, i have
markup file, i have a Java class and i want to get the HTML code resulting
from the render. I understand this is a tricky thing to do but,
nevertheless, possible.

Has anyone accomplished this?

The only thing i have tried so far (and without success) is adding the
following method on a class that inherits from WebMarkupContainer:

public String getHtml(){
      final Response origResponse = getRequestCycle().getResponse();
        try{
            final StringResponse stringResponse = new StringResponse();
            getRequestCycle().setResponse(stringResponse);
            renderAssociatedMarkup("panel", "");
            return stringResponse.toString();
        }catch(Exception e){
                         e.getMessage();
        }finally{
            getRequestCycle().setResponse(origResponse);
        }
        return "";
    }

however, it results in the an exception ("page not found for component foo")

Does this ring a bell to anyone? thanks in advance!
Rafael

Reply via email to