一航情况下,通过ofbiz生成的html页面的代码中都有很多的注释。标示了这一块html
的生成信息。就如同这样:
这些信息,对于我们在开发过程序调试我们的程序是有用的,但是当我们的系统上线运行后,还让系统生成这引些不必须的注释似乎不是什么好注意。这其中出于效率的考虑,安全的考虑,甚至于出于网络流量的考虑我们应该在系统上线以后,让系统不要再生成这些对我们的客户并不重要的信息。
具体的步骤如下:
有一个配置文件在framwork\widget\config\widget.properties。widget.properties 是用于控制ofbizwidget的配置文件,包括FTL模板、编码等。在这个文件中的widget.verbose设置为就是用于控制是否生成这些注释的。默认情况下它是false即不会生成注释了。
在widget\screen\MacroScreenRenderer.java中
public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
if (section.isMainSection) {
this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context);
}
if (this.widgetCommentsEnabled) {
Map<String, Object> parameters = FastMap.newInstance();
StringBuilder sb = new StringBuilder("Begin ");
sb.append(section.isMainSection ? "Screen " : "Section Widget ");
sb.append(section.getBoundaryCommentName());
parameters.put("boundaryComment", sb.toString());
executeMacro(writer, "renderSectionBegin", parameters);
}
}
由以上的代码可看出如果widgetCommentsEnabled为true才会加入注释。而widgetCommentsEnabled正是由widget.verbose控制的。
由此我们可以知道,只要更改这个配置就可以了,不信你可以试一下呀.
的生成信息。就如同这样:
这些信息,对于我们在开发过程序调试我们的程序是有用的,但是当我们的系统上线运行后,还让系统生成这引些不必须的注释似乎不是什么好注意。这其中出于效率的考虑,安全的考虑,甚至于出于网络流量的考虑我们应该在系统上线以后,让系统不要再生成这些对我们的客户并不重要的信息。
具体的步骤如下:
有一个配置文件在framwork\widget\config\widget.properties。widget.properties 是用于控制ofbizwidget的配置文件,包括FTL模板、编码等。在这个文件中的widget.verbose设置为就是用于控制是否生成这些注释的。默认情况下它是false即不会生成注释了。
在widget\screen\MacroScreenRenderer.java中
public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException {
if (section.isMainSection) {
this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context);
}
if (this.widgetCommentsEnabled) {
Map<String, Object> parameters = FastMap.newInstance();
StringBuilder sb = new StringBuilder("Begin ");
sb.append(section.isMainSection ? "Screen " : "Section Widget ");
sb.append(section.getBoundaryCommentName());
parameters.put("boundaryComment", sb.toString());
executeMacro(writer, "renderSectionBegin", parameters);
}
}
由以上的代码可看出如果widgetCommentsEnabled为true才会加入注释。而widgetCommentsEnabled正是由widget.verbose控制的。
由此我们可以知道,只要更改这个配置就可以了,不信你可以试一下呀.