2013-02-11 3 views
4

Jar에서 Zul을로드하는 방법을 아는 사람은 누구입니까? 저는 Zul이 포함 된 도서관 프로젝트를 가지고 있습니다. 현재 createComponents (String uri, Component parent, Map arg)를 사용하지만 jar 파일에서 uri를 참조 할 수 없거나 참조 할 수 없습니다.Jar에서 ZUL로드


지금 사용

public static Component createComponentsFromJar(final String path, final Component parent, final Map<?,?> arg) throws IOException { 
    final InputStream resourceAsStream = ComponentHelper.class.getClassLoader().getResourceAsStream(path); 
    final PageDefinition pageDefinition = Executions.getCurrent().getPageDefinitionDirectly(new InputStreamReader(resourceAsStream), "zul"); 
    resourceAsStream.close(); 
    return Executions.createComponents(pageDefinition, parent, arg); 
} 

는 새로운 페이지를 만드는이 방법 몇 가지 문제를 알고 있나요? 어떤 바인딩 문제 또는 someting? ZK 특정 URI와 함께 작동합니다

+0

왜 당신을 웹 프로젝트 위트를 혼합하고있다. h 순수 자바 코딩이 유형의 코딩을 보지 못했습니다. –

+0

동적 인 마법사를 만들었습니다. 다음과 같이 마법사에 페이지를 추가 할 수 있습니다. pages.add (새 WizardPageConfig (SOMEID, "/pages/personWizard/pageStart.zul")); 이 마법사 로직은 우리의 프레임 워크에 있으며 마법사의 파일 업로드 페이지는 기본 zul이며 프레임 워크에도 있어야합니다. – Kani

+0

은 이런 종류의 것입니까? –

답변

6

Executions.createComponents이 (Inter-Application Communication 참조) 여기서 "~./"ZK 특정 URI는 "클래스 경로/웹/"SRC "아래 ZUL 페이지를 가정에서 파일을 얻을 것이다으로/아래 웹/ZUL는/페이지 "

zul page under src

그리고 당신은 당신은 아래 항아리에서 ZUL 파일과 구성 요소를 만들 수 있습니다, 항아리로 src 폴더를 내보내기 :

Executions.createComponents("~./zul/pages/zulInJar.zul", parent, null); 
+0

답변을 주셔서 감사합니다 –

+0

thx가 잘 작동합니다! – Kani