Hi,

I am trying to create the markup(generating html) using
IMarkupResourceStreamProvider at runtime.
The scenario is as follows.

I am using a java class called DisplayPage

public class DisplayPage extends WebPage implements
IMarkupResourceStreamProvider{
        
        String HTMLString="";
        
        public DisplayPage () {
                String type= getRequest().getParameter("type");
                HTMLString = generateHTML(type);
        }

         public IResourceStream getMarkupResourceStream(MarkupContainer
container, java.lang.Class
                                                                                
                       
containerClass){
                return new StringResourceStream(HTMLString);
        }

       public String generateHTML(String type){
            if(type.equalsIgnoreCase("image")){
                  createImage("image1");
                  add(new Image("image1"));
            }else if(type.equalsIgnoreCase("text")){
                  createLabel("text1");
                 add(new Label("text1"));
            }
        }
}

These methods creaImage() and creteLabel() will construct the html tags for
Image and label with wicket-ids image1 and text1 respectually.

The problem now here is, when I call this class from my browser using the
url
http://localhost:8080/myapp/displaypage?type=image
It displays the image that I am returning in my createImage() method.

If I again call by passing the text parameter using the url
http://localhost:8080/myapp/displaypage?type=text
it gives the error saying that the component with id 'image1' is not found.

If I restart my tomcat between the two requests, it works fine but I can not
flush the markup content that I was getting from getMarkupResourceStream()
method if I am making the two requests without restarting my server.
I tried to debug the content that getMarkupResourceStream() is returning,
but the method will be called only once when the first request is made. The
second time this method will not be called.

Is there any way I can solve this problem.

Thanks,
Venkat


-- 
View this message in context: 
http://www.nabble.com/How-to-flush-the-markup-stream-in-getMarkupResourceStream%28%29-method-tp14424660p14424660.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to