2011-04-14 4 views

답변

3

글쎄, 확실히 서버에 HTML 스 니펫을 만들 수 있습니다. 이 같은 :

서버 측 :

public class MyServiceImpl extends RemoteServiceServlet implements MyService { 

    public String getHtmlSnippet(String param) { 

    String html = buildHtmlSnippetInASafeWay(param); // Use any (safe) HTML 
                // builder you like. (this 
                // is not GWT related!) 
    return html; 
    } 
} 

클라이언트 측 :

myService.getHtmlSnippet(myParam, new AsyncCallback<String>() { 

    @Override 
    public void onSuccess(String result) { 
    myParent.add(new HTML(result)); 
    // or: myElem.setInnerHTML(result); 
    } 

    @Override 
    public void onFailure(Throwable caught) { 
    // ... 
    } 
}); 

하지만 더 나은 솔루션 복사, 당신이 당신의 비 GwtCompatible에서 필요한 데이터를 간단한 데이터 객체를 생성하는 아마 클래스를 객체에 추가하고, 클라이언트로 전송 한 다음 평소와 같이 사용합니다.

관련 문제