0

Zul from file/db served by Richlet: processing instructions (link, meta) ignored

asked 2012-12-09 13:34:17 +0800

RetoH gravatar image RetoH flag of Switzerland
44 5

updated 2012-12-09 13:35:20 +0800

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>

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-12-09 13:53:41 +0800

RetoH gravatar image RetoH flag of Switzerland
44 5

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).

:-(

link publish delete flag offensive edit

answered 2012-12-09 14:09:22 +0800

RetoH gravatar image RetoH flag of Switzerland
44 5

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\"/>");

    [...]
  }

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-12-09 13:34:17 +0800

Seen: 63 times

Last updated: Dec 09 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More