ofbiz

1.Form结果列表中,所有input标签会合成一列,display和link标签不会合并成一列

            原因是:框架默认把group-columns属性设置为:"true"。

            解决方法:把group-columns属性设置为:"false"。

2.如何让Form Widget中的combobox根据传进来的key自动选择要显示的item?

如下代码可以实现此目的:

<drop-down current="selected" current-description="" no-current-selected-key="${selected-key-value}">
  <option key="11" description="采样仪器" />
  <option key="12" description="现场分析仪器" />
  <option key="13" description="实验室分析仪器" />
  <option key="14" description="其他" />                  
</drop-down>

    实践证明,current-description是不起作用的,如果<option>的key值是中文,那么也不能起作用

3.Screen/Form Widget中<set>的缺省值.

    <set>支持缺省值设置,譬如:

<set field="productId" from-field="productId" default-value="0"/>

       

4.调用OFBiz内的其它应用时,如何避免重复登陆. &para; &para;

    在调用的表单(post方式)或者parameters(Get方式)中添加externalLoginKey=${externalLoginKey}

5.Form Widget中hyperlink的target-type.

    Form Widget中,hyperlink类型的字段有一个target-type属性,它是用来描述target属性设置的url和当前应用的URL之间的关系的。假设一个hyperlink的target="targeturi",而当前应用的url是http://<site>/webapp/control/main,则:

  1. target-type="intra-app":缺省设置,表示在应用内部(intra词根表示内部),最终的target是http://<site>/webapp/control/targeturi

  2. target-type="inter-app":表示不同应用之间,最终的target是http://<site>/targeturi

  3. target-type="plain":表示直接使用target,最终的target就是targeturi(如果targeturi以http等internet协议开头(或者javascript:开头的js调用),则直接转向targeturi;如果targeturi是以'/'开头的绝对路径,这转向http://<site>/targeturi;如果targeturi是相对路径,则转向http://<site>/webapp/control/targeturi)

  4. target-type="content":表示静态内容(image, js, css等)的路径,最终的target根据url.properties中的content.url.prefix.standard的值和targeturi生成。该类型主要是为了在不同的服务器之间迁移OFBiz应用的时候,保持静态内容的可访问性而测试的

6. 如何只返回大数据集的首行记录

    进行数据库查找时,有时候,我们只会使用到返回列表的第一行数据,这时,需要通知数据库只返回第一行,以提高效率:

EntityFindOptions findOptions = new EntityFindOptions(......);
findOptions.setMaxRows(1);
...
List<GenericValue> resultList = delegator.findList(..., findOptions);

设置最大行数为1,如果查找结果有几万行的,则数据库只会返回第一行,相比而言节省了内存空间也提高了效率。

7.OFBiz中如何限制上传文件的大小.

    general.properties中的http.upload.max.size参数可以限制上传文件的大小(单位bytes),缺省设置是"-1",表示无限制。


你可能感兴趣的:(ofbiz)