在我的Icefaces3应用程序中,我有Manage bean祖先,它定义了包括要应用的CSS在内的常见属性,因为菜单上的图标会根据所选的内容而改变。托管bean定义了要应用于这些图标的样式。如何在XHTML文件中映射它?
CommonMBean.java:
package com.omb.view;
public class CommonMBean
private String menu1Css = "";
private String menu2Css = "";
public String getMenu1Css() {
return this.menu1Css;
}
public void setMenu1kCss(String menu1Css) {
this.menu1Css = menu1Css;
}
public String getMenu2Css() {
return this.menu2Css;
}
public void setMenu2Css(String menu2Css) {
this.menu2Css = menu2Css;
}
}
FirstMBean.java:
package com.omb.view;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.accor.gestpro.view.AbstractBackingBean;
@Controller
@Scope("session")
public class FirstMBean extends CommonMBean {
public String displayMenu1() {
setMenu1Css("menu1Sel");
setMenu2Css("menu2");
return "menu1";
}
}
SecondeMBean.java:
package com.omb.view;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.accor.gestpro.view.AbstractBackingBean;
@Controller
@Scope("session")
public class SecondeMBean extends CommonMBean {
public String displayMenu2() {
setMenu1Css("menu1");
setMenu2Css("menu2Sel");
return "menu2";
}
}
XHTML文件:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<body>
<ui:composition>
<ice:form id="buttonsForm" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ul class="mainMenu">
<li class="home"><ice:commandLink
**styleClass="#{firstMBean.menu1Css}"** value="Menu 1"
action="#{firstMBean.displayMenu1}" /></li>
<li class="activity"><ice:commandLink
**styleClass="#{secondeMBean.menu2Css}"**
value="Menu 2"
action="#{secondeMBean.displayMenu2}" />
</ul>
</ice:form>
</ui:composition>
</body>
</html>
我在这做什么:styleClass =“???” :