Questions tagged «jsf»

3
是否应该用单个javabean getter代替复杂的EL表达式?
在JSF中,如果我有一个根据多个变量有条件地进行渲染的组件,那么处理render语句的最佳方式是什么...该逻辑应存在于组件声明中还是以某种形式的帮助器类存在? 仅当动物是大象或狗并且动物没有静音时才显示文本woof。 选项1: 在视图中的实现: <h:outputText id="text" value="woof" rendered="#{animal.type == 'elephant' or animal.type == 'dog' and not(animal.mute)}"/> 或选项2: 封装形式: <h:outputText id="text" value="woof" rendered="#{animal.barkingAnimal}"/> 与实施: public class Animal { public boolean isBarkingAnimal() { return ("dog".equals(getType()) || "elephant".equals(getType())) && !isMute(); } ... 因此,两者都可以工作...但是哪种是正确的方案?
10 jsf 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.