JSF2 MyFaces and CDATA makes f:ajax render fail

前端 未结 2 1334
半阙折子戏
半阙折子戏 2021-01-28 20:06

I\'m facing some problems using CDATA blocks inside h:outputscripts with MyFaces 2.0... but I don\'t know exactly if I should avoid using CDATA with JSF2 or if it is because I d

2条回答
  •  迷失自我
    2021-01-28 20:23

    I can't answer if you're the only one having problems with it. I can at least answer that having JS code plain in a XML file is a poor practice. JS code is not well formed XML. Fiddling with escaping XML-special characters in JS code or putting JS code in CDATA blocks is plain ugly. That it gives troubles in JSF ajax response is in turn a different story. Technically, that would have been a bug in the JSF implementation used. But from the other side on, you're actually practicing a poor practice.

    Just put JS code in its own .js file which you reference by .

    
        
        ...
    
    

提交回复
热议问题