-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm trying to serve a zul file via Richlet, but the <?page...?>, <?meta ...?> and <?link ... ?> instructions are ignored. They work for normal *.zul pages.
How can I serve a zul from file/db and also process these instructions?
My Richlet:
public void service(Page page) throws Exception { String content = IoTools.fileToString(new File(Context.get(page).getWebAppDir(), "WEB-INF/test.zul"), "UTF-8"); Component component = Executions.getCurrent().createComponentsDirectly(content, "zul", null, null); component.setPage(page); }
My test.zul content:
<?page title="My title 1" ?> <?meta name="description" content="" ?> <?meta name="keywords" content="a, b, c" ?> <?link rel="shortcut icon" type="image/x-icon" href="/_static/favicon.png" ?> <?link rel="stylesheet" type="text/css" href="/_static/style.css" ?> <div id="container" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('test.MyViewModel')"> <label value="@bind(vm.name)" ></label> </div>
Hm, I just read in the docs that the processing directives have no function when loaded in this way (http://books.zkoss.org/wiki/ZK%20Developer%27s%20Reference/UI%20Composing/ZUML/Load%20ZUML%20in%20Java).
:-(
Now I am trying to set these things programmatically in the Richlet.
So far I've got this (which seems to work, but the javadoc of CtrlPage says the developer should never access these methods):
public void service(Page page) throws Exception { ((PageCtrl) page).addAfterHeadTags("<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\"/>"); [...] }
Asked: 2012-12-09 13:34:17 +0800
Seen: 63 times
Last updated: Dec 09 '12