From: "Gordon" <[EMAIL PROTECTED]> > 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.
Sorry this took a while to get to. I finally got chance to create a test case for this and fixed the bug. It only seemed to show up when using variables with dots in them (which are handled slightly different as often dot means 'get the property of the map/bean'). The JellyUnit test case is now working... (testVariablesWithDots at the end of the file) http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/src/test/org/apa che/commons/jelly/suite.jelly?rev=HEAD I think its fixed now in CVS HEAD. James ------- http://radio.weblogs.com/0112098/ > > 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]> > __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
