I have a selectOneRadio menu with some selectItem. I want to show an option based on the property file. For example, if a store does not have a credit card reader, then I will not show the credit option
Is there any way to accomplish this? I think I need to read the property file in the backing bean and then something like a 'render' feature. However, I tried and did not work for 'IT'.
& lt; H: Selection onride ID = "selected payment method" layout = "page direction" value = "# {selection payment mode action selectedPaymentMethod}" & gt; & Lt; F: selection item item value = "online" item label = "# {payment payment ['payment .online.lbl']}" /> & Lt; F: Selection item item Value = "cash" itemLabel = "# {paymentMsg ['payment.cash.lbl']}" /> & Lt; F: selection item item value = "credit" item label = "# {payment payment ['payment.rad.lbl']}" /> & Lt; F: selection item item value = "debit" item label = "# {payment payment ['payment.dbitt.ll']}" /> & Lt; / H: selectOneRadio & gt;
Use & l: f: selectItems & gt; based on the bundle file list & lt; SelectItem & gt; With this, you can control using the normal Java code in such a way whether the item should be added or not. Example
& lt; F: selectItems value = "# {selectPaymentMethodAction.paymentMethods}" / & gt; with
private list & lt; SelectItem & gt; Payment method; // + Recipient Public Bean () {Payment Methods = New Arreelist & lt; SelectItem & gt; (); Resource Bundle Bundle = ResourceBundle.getBundle ("com.example.Messages", FacesContext.getCurrentInstance (). GetViewRoot (). GetLocale ()); If (status) {paymentMethods.add (new selection item ("online", bundle .getString ("payment.online.lbl")); } // ...}
Comments
Post a Comment