on 06-30-2014 12:02 AM
I'm working on a custom activity for SAP ME. My basic requirement is to 'gray out' the label under certain circumstances determined by the logic in the Controller class. My view contains "fh:outputLabel" elements (taglib prefix="fh" uri=http://java.sun.com/jsf/html). I would like to put an EL expression into the styleClass attribute. This would be the example:
<fh:outputLabel value="#{gapiI18nTransformer['NONPOD_INVTRANSFER.transqty.LABEL']}"
styleClass="#{inventoryTransferBean.transQtyLabelStyle}" />
From a bit of exploration of the JSF documentation, it appears that JSF 2.2 allows this, while JSF 1.1 does not. In fact, when I try it, the entire page disappears. Nothing even appears in View Source.
Any suggestions?
Thanks,
Barry
Hello Barry ,
I have added label to jsp inside form with id = "materialCustomDataForm" :
<fh:outputLabel id="LABEL_ID" value="Label" />
Then I found component by id , logic in controller class :
HtmlOutputLabel labelID = (HtmlOutputLabel) findComponent(FacesUtility.getFacesContext().getViewRoot(), "materialCustomDataForm:LABEL_ID");
Then I defined style to label :
labelID.setStyle("color:#0000AA;font-weight:bold;font-size:20pt;");
Then I should refresh panel with this label :
UIComponent fieldButtonPanel = findComponent(FacesUtility.getFacesContext().getViewRoot(),"materialCustomDataForm:fieldButtonPanel");
if (fieldButtonPanel != null) {
FacesUtility.addControlUpdate(fieldButtonPanel);
}
Thanks,
Oksana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oksana,
Thank you! I think I can use this.
The 'procedural' approach is a bit more code, so if there is a more 'declarative' solution, I would still be interested to hear about it (from anyone).
I would also be interested to hear if anyone has seen a similar 'error behavior' -- where a small change in an attribute causes the whole page to go blank.
Barry
User | Count |
---|---|
100 | |
11 | |
10 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.