ofbiz 菜单应用
ofbiz 的菜单控制在xxxMenus.xml中,应用方式在screens.xml中讲菜单包含进来。
<widgets><include-menu name="AgreementTabBar" location="component://accounting/widget/Menus.xml"></include-menu></widgets>
ofbiz中调用js/css文件
是要在WEB.XML中的
<param-name>allowedPaths</param-name><param-value>
/jslib:/control:/select:/index.html:/index.jsp:/default.html:/CSS:/UserFiles:/default.jsp:/images:/include:/themes:/jscalendar:/modules
</param-value>
中添加你的JS/CSS样式表的文件夹
http://ofbiz.3ren.com/profiles/blog/show?id=2838541489140161:BlogPost:2895618194241142</p>
获取GenericDelegator对象
使用HttpServletRequest对象
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
GenericDelegator类的静态方法
GenericDelegator delegator = GenericDelegator.getGenericDelegator(delegatorName);
防止JS注入
如果你允许用户在页面的INPUT或TEXTAREA中输入特殊符号(比如<或 >)
设置你的xxxservices.xml
<service name="" engine="java"
location="" invoke="">
<attribute name="description" mode="IN" type="String" optional="true" allow-html="safe"/>
</service>
默认情况ofbiz不允许用户输入特殊符号,加上allow-html="safe"就OK了。
ofbiz中使用原始的HttServletRequest和HttpServletResponse
首先配置controller.xml
<request-map uri="testProtoRequest"> <event type="java" path="org.ofbiz.hello.product.ProductServices" invoke="testProtoRequest"/> <response name="success" type="none"/> <response name="error" type="none"/> </request-map>
然后编写的class
public static String testPotoRequest(HttpServletRequest request, HttpServletResponse response) {
}