后台 public class DemoController extends Controller { public void xml1() { WepayResponseXml wepayResponseXml = new WepayResponseXml(); wepayResponseXml.setCode("success"); wepayResponseXml.setMessage("ok"); this.setAttr("obj", wepayResponseXml); this.setAttr("message", "ok"); this.setAttr("code", "success"); this.renderXml("/template/wepay_callback_response.xml"); } } 前台 <xml> <return_code1><![CDATA[${code}]]></return_code1> <return_code><![CDATA[${obj.code}]]></return_code> <return_msg><![CDATA[${obj.message}]]></return_msg> </xml>
如上进行xml渲染时,无论我用Object还是字符串setAttr最终xml中都拿不到值,请问应该如何传值?
UPDATE:
Jfinal3.0中,xml的渲染引擎换成JfinalTemplateEngine,使用新的语法就可以读到值:#(obj.message)