|
楼主 |
发表于 2016-3-21 15:25:29
|
显示全部楼层
发现是静态页面中,替换文件的时候,出现错误
/UI2/OA/knowledge/process/publishKnowledge/extend/dsrc/GenerateStaticPage.java
private String replacePicture(String templeteContent, Element templete,
Element pics) {
Pattern pattern = Pattern.compile("\\$\\{pic\\}");
Matcher m = pattern.matcher(templeteContent);
int i = 0;
while (m.find()) {
String g = m.group();
i++;
if (pics.elements().size() + 1 > i) {
String value = ((Node) pics.selectSingleNode(".//pic[" + i
+ "]")).getText();
value = value.replaceAll("\\$", "\\\\\\$");
templeteContent = templeteContent.replaceAll("\\$\\{pic\\}",
value);
}
}
使用了replaceAll,结果三个图片占位符都被替换了。
我的解决办法是:
修改模板文件:\UI2\OA\knowledge\res\template\txtAnd3PicTemplate.html
把pic占位符改为pic1,pic2,pic3占位符。
修改替换程序:/UI2/OA/knowledge/process/publishKnowledge/extend/dsrc/GenerateStaticPage.java
private String replacePicture(String templeteContent, Element templete,
Element pics) {
Pattern pattern = Pattern.compile("\\$\\{pic\\d}");
自己留个记录。
|
|