I'm having problems setting and getting variables with Jelly. If the
variables have a "." in the name, Jelly can't retrieve the value in the
script.
For example...
OutputStream output = new FileOutputStream("demopage.html");
JellyContext context = new JellyContext();
context.setVariable("page.name",nameField.getText());
context.setVariable("page.background",colorField.getText());
context.setVariable("page.url",urlField.getText());
// Set the hobby list
Vector v = new Vector();
Enumeration enum= listModel.elements();
while (enum.hasMoreElements()) {
v.add(enum.nextElement());
}
context.setVariable("page.hobbies", v);
XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
context.runScript("src/test/org/apache/commons/jelly/demos/"+template),
xmlOutput);
xmlOutput.flush();
The Jelly template looks like this:
<?xml version="1.0"?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml"
xmlns:html="jelly:html">
<html>
<head>
<title>${page.name}'s Page</title>
</head>
<body bgcolor="${page.background}" text="#FFFFFF">
<h1>${page.name}'s Homepage</h1>
<img src="${page.url}"/>
<h2>My Hobbies</h2>
<ul>
<j:forEach items="${page.hobbies}" var="i">
<li>${i}</li>
</j:forEach>
</ul>
</body>
</html>
</j:jelly>
All the variable return an empty string.
Gordon
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>