Support #4857

How to get XML working?

Added by Matt Picas almost 7 years ago. Updated almost 3 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


I'm trying to use the example code found here:

My application has the approot and docroot set, and it has a wt_config.xml file and a separate WTemplate-example.xml file. I have app~~messageResourceBundle().use(app~~>appRoot() + "WTemplate-example"); in my main file.

Unfortunately all I see is WTemplate-example since it can't find my resource. I am using the same code in the xml file as in the example and the same C code, with the template bound to my parent container. Can someone tell me what I am doing wrong?


Updated by Koen Deforche almost 7 years ago

  • Status changed from New to Feedback

That looks all fine. How are you starting your wt process? It needs to know the location of the approot? What do you see exactly? You should see 'something-here' if it couldn't resolve the template from the message resource bundle?


Updated by ZAITAO HUANG almost 3 years ago

me too, I also encountered this problem

i don't how to solved.


Updated by ZAITAO HUANG almost 3 years ago

I have solved this problem.

first. XML code snippet incompete Example: HTML Templates XML code snippet incomplete.

<?xml version="1.0" encoding="UTF-8"?>
<message id="WTemplate-example">
<div class="form">
<label>Please enter your name: ${name-edit}</label>
${save-button} ${cancel-button}

in c code :


auto t = root()->addWidget(Wt::cpp14::make_uniqueWt::WTemplate(Wt::WString::tr("WTemplate-example")));

t->bindWidget("name-edit", Wt::cpp14::make_uniqueWt::WLineEdit());

t->bindWidget("save-button", Wt::cpp14::make_uniqueWt::WPushButton("Save"));

t->bindWidget("cancel-button", Wt::cpp14::make_uniqueWt::WPushButton("Cancel"));

put the xml file: html_temp.xml project current directory

Also available in: Atom PDF