> Hi, > > is there a way to change only components and not reload the hole page? In > example i have an activex component on the page (an image viewer). I can > control the image viewer with java script ( goToNextPosition() and so on). > For every position the user should be able to make some comments with some > forms. So if the user press the send button for the forms the activex > component should not reload (because it takes a while to load it). Is > there > a way to do this with tapestry, or with tapestry + ajax? > > Best regards, >
Hi Sabine, If you are trying to get only some elements of a page through an ajax request, assuming you are using T4, you could implement a class that inherits from AbstractComponent and overrides renderComponent() method. @Override protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { StringBuffer s = new StringBuffer(); writer.begin("script"); writer.attribute("type", "text/text"); s.append("the elements for your next forms"); writer.printRaw(new String(s)); writer.end(); } this component could then be accessed directly if it also implements IDirect or through a BasePage. Your javascript should be responsible for calling this component and then replacing the right elements of the page with the returned elements of this Tapestry component. Loïc