下拉框的国际化
<f:selectItem itemLabel="1" itemValue="#{messages['permission.create']}}"/>
?
f:selectItems是没有办法来国际化的,可以使用s:selectItems来代替
<f:selectItems value="#{permissionManageAction.allRoles}"/>
?
<s:selectItems value="#{...list}" var="action"
??? ??? ??? ??????????????? label="xxxx#{messages[action]}xxx"/>
create
?
<s:selectItems value="#{...list}" var="action"
??? ??? ??? ??????????????? label="xxxx#{messages[seamutil.add('security.').add(action).display()]}xxx"/>
security.create
?
下面的类帮助我们在页面无限次拼装字符串,就像我们在java中使用StringBuffer一样
@Name("seamutil")
public class SeamUtil {
??? private String adds="";
??? public SeamUtil add(String str){
??? ??? adds=adds+str;
??? ??? return this;
??? }
??? public String display(){
??? ??? String tmp=adds;
??? ??? adds="";
??? ??? return tmp;
??? }
附件图片所示s:selectItems的bug
多次循环s:selectItems时会导致,label="#_var 引用的循环变量输出混乱,
用ui:repeat 结果是正确的。
?
??? ??? ??? ??? ??? <rich:dataTable value="#{permissionManageAction.allPermissionActions}" var="_var">
??? ??? ??? ??? ??? ??? <rich:column>
??? ??? ??? ??? ??? ??? ??? <f:facet name="header">
??? ??? ??? ??? ??? ??? ??? ??? #{messages['permission.manage.module']}
??? ??? ??? ??? ??? ??? ??? </f:facet>
??? ??? ??? ????? ??? ? ??? ??? #{messages['security.module.'+_var[0].modelName]}
??? ??? ??? ????? ??? ? ??? </rich:column>
??? ??? ??? ????? ??? ? ??? <rich:column>
??? ??? ??? ??? ??? ??? ??? <f:facet name="header">
??? ??? ??? ??? ??? ??? ??? ??? #{messages['permission.manage.actions']}
??? ??? ??? ??? ??? ??? ??? </f:facet>??? ??? ??? ????? ??? ? ???
??? ??? ??? ????? ??? ? ??? ??? <h:selectManyCheckbox value="#{_var[1]}" border="0" stylevar="action" label="#{messages['security.'+_var[0].modelName+'.'+action]}"/>
??? ??? ??? ????????????? ??? </h:selectManyCheckbox>
??? ??? ??? ????? ??? ? ??? </rich:column>
??? ??? ??? ??? ??? </rich:dataTable>
?
?
?
<ui:repeat value="#{permissionManager.listAvailableActions(_var[0].modelInstance)}" var="action" >
??? ??? ??? ????????????? ??? ??? #{messages['security.'+_var[0].modelName+'.'+action]}
??? ??? ??? ????????????? ??? </ui:repeat>