struts2在前台通过property获取属性值某些字符转义问题

    技术2022-05-20  46

    在使用中发现以下问题:某个字段中包含&字符,在前台页面通过

     

    var postParam = new Ext.form.TextArea({

    fieldLabel : 'POST参数',

    id : 'postParam',

    name : 'normalModelDetail.postParam',

    height : 70,

    width : 405,

    value : '<s:property value="#normalModelDetail.postParam"/>'

    });

     

    展示出来的字段里边的&都变为& 了。

     

    解决方法:在获取字段值时,加上escape="false"

    var postParam = new Ext.form.TextArea({

    fieldLabel : 'POST参数',

    id : 'postParam',

    name : 'normalModelDetail.postParam',

    height : 70,

    width : 405,

    value : '<s:property value="#normalModelDetail.postParam" escape="false"/>'

    });

     


    最新回复(0)