Project

General

Profile

Actions

Support #4857

open

How to get XML working?

Added by Matt Picas about 8 years ago. Updated almost 4 years ago.

Status:
Feedback
Priority:
High
Assignee:
-
Target version:
-
Start date:
04/14/2016
Due date:
% Done:

0%

Estimated time:

Description

I'm trying to use the example code found here: https://www.webtoolkit.eu/widgets/layout/html-templates

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?

Actions #1

Updated by Koen Deforche about 8 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?

Actions #2

Updated by ZAITAO HUANG about 4 years ago

me too, I also encountered this problem

i don't how to solved.

Actions #3

Updated by ZAITAO HUANG almost 4 years ago

I have solved this problem.

first. XML code snippet incompete https://www.webtoolkit.eu/widgets/layout/html-templates Example: HTML Templates XML code snippet incomplete.

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

in c code :

messageResourceBundle().use("html_temp");

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

Actions

Also available in: Atom PDF