Can I set the value of a list binding in my managed bean?
Dear All,
This is just an exercise for me and I just wanted to experiment on the bindings of ADF for me to understand it further.
I wanted to create a custom Model Driven LOV with my data control listed below
Countries
-CountryId
-CountryName..but I wanted to display the label similar to this
1 - USA
2 - England
n - France..so I thought of manipulating the select items in a bean
<af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
<f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
</af:selectOneChoice>..and the code similar to this
public class MyBean{
public List<SelectItem> getCountries(){
//countryMap points to accessing the iterator binding
//BindingsHelper is a utility class that sets the value
for(...){
SelectItem item = new SelectItem();
item.setLabel(countryMap.get("CountryId") + " - " + countryMap.get("CountryName"));
item.setValue(countryMap.get("CountryId"));
list.add(item);
//set the item to the first row
BindingsHelper.setExpressionValue("#{bindings.Countries.inputValue}",
list.get(0).getValue());
return list;
}...on the last part I wanted to set the value to the first item but I am encountering numberformatexception when setting the list binding.
I know I can do this declaratively also by removing the unselected item but as I have said I am experimenting on the bindings.
Is this not possible?
Thanks.
JDev 11G PS5
Hi ,
I understand that , you want to show select one choice (dropdown) with label (countyid - country name) and value is (countryid).
and these informnation is coming from ADf Model ( may be a VO).
in the UI page you used this list is coming from MyBean
<af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
<f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
</af:selectOneChoice>
so ,
The Managed Bean code should be ,
private List<SelectItem> countries;
///setter method
public void setCountries(List<SelectItem> countries) {
this.countries= countries;
// getter method
public List<SelectItem> getQuoteStatusList() {
quoteStatusList =
selectItemsForIterator("countriesVOIterator",
"countryId", "countryName");
return quoteStatusList;
public static List<SelectItem> selectItemsForIterator(String iteratorName, String valueAttrName, String displayAttrName) {
return selectItemsForIterator(findIterator(iteratorName), valueAttrName, displayAttrName);
public static DCIteratorBinding findIterator(String name) {
DCIteratorBinding iter = getDCBindingContainer().findIteratorBinding(name);
if (iter == null) {
throw new RuntimeException("Iterator '" + name + "' not found");
return iter;
public static List<SelectItem> selectItemsForIterator(DCIteratorBinding iter, String valueAttrName, String displayAttrName) {
List<SelectItem> selectItems = new ArrayList<SelectItem>();
for (Row r : iter.getAllRowsInRange()) {
string labelValue = (String)r.getAttribute(valueAttrName) +"-"+ (String)r.getAttribute(displayAttrName);
selectItems.add(new SelectItem(r.getAttribute(valueAttrName),labelValue ));
return selectItems;
this will give you what you except in the ui
when you try to get the value form that seclecOneChoice value in MyBean what user selects , you can simply get the value of this selectOneChoice.
Similar Messages
-
How to set the value of process variables/payload using a managed bean?
Hello,
Someone can give me an example about how to set the values of a process payload in a managed bean?
thank you!Try this:
jsf page:
<af:selectOneChoice label="Select Suburb"
requiredMessageDetail="Select a suburb"
valueChangeListener="#{selectOneChoiceBean.onValueChanged}"
validator="#{selectOneChoiceBean.validate}"
unselectedLabel="None" autoSubmit="true"
binding="#{selectOneChoiceBean.selectOneChoice}"
value="#{selectOneChoiceBean.value}">
<f:selectItems value="#{selectOneChoiceBean.selectionList}"/>
</af:selectOneChoice>
backing bean:
public class SelectChoiceBean {
private List<SelectItem> selectionList;
private String value = "B";
private RichSelectOneChoice selectOneChoice;
public SelectChoiceBean() {
initSelectionList();
public void setSelectionList(List<SelectItem> selectionList) {
this.selectionList = selectionList;
public List<SelectItem> getSelectionList() {
return selectionList;
public void onValueChanged(ValueChangeEvent valueChangeEvent) {
System.out.println(valueChangeEvent.getNewValue());
// Add event code here...
public void validate(FacesContext facesContext, UIComponent uIComponent,
Object object) {
// Add event code here...
private void initSelectionList() {
selectionList = new ArrayList<SelectItem>();
selectionList.add(new SelectItem("A", "A label"));
selectionList.add(new SelectItem("B", "B label"));
selectionList.add(new SelectItem("C", "C label"));
public void setValue(String value) {
this.value = value;
public String getValue() {
return value;
public void setSelectOneChoice(RichSelectOneChoice selectOneChoice) {
this.selectOneChoice = selectOneChoice;
public RichSelectOneChoice getSelectOneChoice() {
return selectOneChoice;
} -
How can I set the value to a session bean from backing bean
Hi Experts,
How can I set the value to a session bean from backing bean where I have created getter and setter
methods for that variable.
Basically I am using ADFUtils class where I am able to get the value from session bean
using following expression
String claimType =
(String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
Thanks
GayazGayaz,
Wrong Post !!
Post in JDeveloper and ADF
Thanks
--Anil -
Can I set the value of kernel paramaters less than default in Solaris 10?
Can I set the value of kernel paramaters less than default in Solaris 10? If specified less than default values for kernel parameters in /etc/system, system is getting default values for such as SHMMAX, SEMMSL, SEMOPM. Is the default kernel parameter values the minimum values in Solaris 10?
-YongYes, but not through /etc/system.
/etc/system is the old way to do it. As a backward compatibility, it will allow lines there to increase parameters but not decrease them. This is on the theory that many memory defaults were significantly increased, and older /etc/system setups were trying to increase small defaults, not decrease large ones).
Use prctl and set up a project.
Darren -
Can not set the value attribute of a ContextNode
Hi,
I am trying to set the value Attribute in a value Node it is a simple way but it gives me java.lang.NullPointerException error on the given line:
wdcontext.current(ValueNodeName)Element.set(AttributeValueName)
Thanks in advance
Best Regards
BeataLike all above suggested do this:
wdContext.node(ValueNodeName).add(
wdContext.node(ValueNodeName).create(ValueNode)Element()
wdContext.node(ValueNodeName).moveLast();
wdContext.current(ValueNode)Element().setATTR(..); -
How can i set the values to text box by selecting from drop down list.
hi ,
i am using struts and jsps. i have a dropdown list of names(getting the values of names from database), i want to get address and phone number of that selected one.how can i get that?Hi swarupa,
Well My advice in this senario wud Be
Either U can make Use of XmlHttp Object through javascript(AJAX way).
Or U need to Maintain the State of the entire form and then refresh the page to get those results....
just for U r reference i am attaching a link which was programmed using ASP @ server side and which made use of XmlHttp Object.....
http://www.w3schools.com/ajax/ajax_database.asp
Just try to simulate the samething in your own way....
REGARDS,
RAHUL -
How can I set the OS to show list view when I open a file in an application.
So I know you can chose view options in Finder to always show files in list view there. But how do you set the OS to do the same when opening files in an application.
Okay, cheers, so I guess it's stored in the application prefs. I just installed Snow L last week and it bothered me that everytime I opened a document I had to set my pref again. I wasn't aware that it was storing it for that particular app though cause I'm using so many differnt apps. But you are right, it does store for the individual app. Cheers for the answer!
-
Can I set the values number of the parameter LOV?
Hi.
Can I set a number of values in a report prompt LOV? Now is 5 values (All + 4 values of the query). I would like to have 4 o 3 values...
Thank you, bye.
R.Can you please restate your question? It is not clear you would like to get
regards
Jorge -
Can you set the value of a div from a select statment?
Hi all
I have a div that is used as Tool tips for a cell in a table, is there an easy way to set the text in that div to the result of a select statement?
Appreciate the Help
LTselect ename, '<div '||style||'>'||htf.escape_sc(description)||'</div>' description
from some_table
was this what your asking. You need to not escape special characters so the div tag acts as HTML in your report. The data is escaped using a PL/SQL function.
Is this what your asking?
Mike -
How can i get the realpath of my web application in jsf manage bean
in jsp, i can use application.getRealPath("/")
but in jsf how can i get the realpath in manage bean and initializean variable.
thanksFacesContext aFacesContext = FacesContext.getCurrentInstance();
ServletContext context = (ServletContext)aFacesContext.getExternalContext().getContext();
String rootpath = context.getRealPath("/");
i use the code like that ,it can work , but when i click a button in my web page and call a function of java bean to read a file in "rootpath" , only odd number click it do well , even number click it do nothing and navigate to a blank page.
how can i do that ,.
my english is too pool ,sorry. -
Can we set the value of repository variable if we invoke bi publisher
report from Java. The parameter report is built in java they will pass all the parameters and based on the filter critirea
bi publisher report will be generatedHi, this may not be relavent for you but, as I see you are working with BI pub and OBIEE I thought to share my issue.
We have set up OBIEE and BI Pub. When I create a Answer without any prompts it works fine in BI pub and create a template. But, when I have a Answer with prompts and use the same Answer in BI pub, it throws an error and I cannot proceed to create templates.
We did open a SR with metalink (oracle) but they say its the behaviour of BI pub/OBIEE. They want us to create a BI pub report and use the same in OBIEE, which is not what we are looking for.
Anyways, this is just an FYI.
Thanks,
Vijay -
Can we set the value of repository variable in bi publisher as we do in
dashboard prompt.. and if yes then how
Hi, this may not be relavent for you but, as I see you are working with BI pub and OBIEE I thought to share my issue.
We have set up OBIEE and BI Pub. When I create a Answer without any prompts it works fine in BI pub and create a template. But, when I have a Answer with prompts and use the same Answer in BI pub, it throws an error and I cannot proceed to create templates.
We did open a SR with metalink (oracle) but they say its the behaviour of BI pub/OBIEE. They want us to create a BI pub report and use the same in OBIEE, which is not what we are looking for.
Anyways, this is just an FYI.
Thanks,
Vijay -
Create Report Layout (Apex 3.2) - How can I set the substitution variables?
Hi,
I created a "Report Query" under "Shared Components". I now want to work on the corresponding "report layout". I created a "Generic Columns (XSL-FO)". I read the following in the documentation:
The following are valid substitution strings:
#PAGE_HEADER#
#PAGE_HEADERFONT_COLOR#
#PAGE_HEADER_FONT_FAMILY#
#PAGE_HEADER_FONT_SIZE#
#PAGE_HEADER_FONT_WEIGHT#
#PAGE_FOOTER#
#PAGE_FOOTER_FONT_COLOR#
#PAGE_FOOTER_FONT_FAMILY#
#PAGE_FOOTER_FONT_SIZE#
#PAGE_FOOTER_FONT_WEIGHT#
#PAGE_WIDTH#
#PAGE_HEIGHT#
#HEADER_BG_COLOR#
#HEADER_FONT_COLOR#
#HEADER_FONT_FAMILY#
#HEADER_FONT_SIZE#
#HEADER_FONT_WEIGHT#
#BODY_BG_COLOR#
#BODY_FONT_COLOR#
#BODY_FONT_FAMILY#
#BODY_FONT_SIZE#
#BODY_FONT_WEIGHT#
#BORDER_WIDTH#
Where can I set the values for these substitution variables in my "Report Layout"? Could someone give an example? I can't seem to find documentation on this.
Thanks!
FrancoisThanks for the tip however I'm not trying to do this through the print tab, I'm calling the report using the following get_print_document in pl/sql code:
l_report_blob := apex_util.get_print_document(
p_application_id => l_application_id,
p_report_layout_name => l_report,
p_report_query_name => l_report,
p_report_layout_type => l_output_format,
p_document_format => l_output_format,
p_print_server => null);
Where could I set these substitution variables ? I'm simply calling a report query and layout created under Shared Components.
Thanks
Francois -
Setting the value of a java variable in javascript function
How can i set the value of a java variable in a javascript function?
<%
String fName = "";
%>
now i want to define a javascript function which can set the value of fName to the value it has been passed.
<script language="javascript">
function setJValue(val)
</script>
ThanksThe only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.
-
Can't set comboBox value that has valueMember / displayMember
Hello All,
I'm working on a project where I'm dynamically building a form according to a configuration schema. I'm pretty new at C# and got the following issue I can't get sorted out .
Any help, advise would be great !!!
When building a ComboBox I can't set the value I want !!
Probably I'm missing something.
I've tried several methods but nothing does it ... below my code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ComboBoxSample
public partial class Form1 : Form
public Form1()
InitializeComponent();
CreateComboBox();
public void CreateComboBox(){
//Working variables
string valueMember = "idColumn";
string displayMember = "valueColumn";
//Create a panel and add to the form
TableLayoutPanel tlp = new TableLayoutPanel();
this.Controls.Add(tlp);
//Create the data source
DataTable dataTable = new DataTable();
dataTable.Columns.Add(valueMember, typeof(string));
dataTable.Columns.Add(displayMember, typeof(string));
dataTable.Rows.Add("A", "value A");
dataTable.Rows.Add("B", "value B");
dataTable.Rows.Add("C", "value C");
//Create a binding source
BindingSource bindingSource = new BindingSource(dataTable, null);
//Create a comboBox and bind the datasource
ComboBox comboBox = new ComboBox();
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox.DataSource = bindingSource;
comboBox.ValueMember = valueMember;
comboBox.DisplayMember = displayMember;
Try and set the value
//No methode displays B --> combo stays on A
comboBox.SelectedValue = "B";
//comboBox.Text = "value B";
//comboBox.SelectedItem = comboBox.FindStringExact("value B");
//add the controles to the panel
tlp.Controls.Add(comboBox, 0, 0);Hi Viorel_,
Thanks for the reply!!
The setting the value in the form's Load event does work!
I agree for the form designer but it does not fit the need.
What I have is a "meta-data" driven logic where I define a screen that matches database fields:
Example : Screen new person has 5 fields : Gender (combobox) , first name (textbox) , last name (textbox) , type (combobox) ,birthday (datetime)
I have a Form derived class that takes this definition and builds each control at run time.
The definition also comes with potential default values (i.e. :type = client) so what I want to do is affect the value on the fly. This works fine with textbox or datetime. I'm trying to do the same for combobox.
Maybe I got this all wrong from a design point of view.
Maybe you are looking for
-
How do I download Acrobat from my account on to the same computer that crashed and is rebuilt? I see my purchase and SN in my account?
-
If you've updated to OS X and "Photoshop quit unexpectedly" or other strange things happen
Make sure you're operating in 64-bit mode, not 32-bit mode. I had a number of problems after my upgrade until I switched back to 64-bit mode, now it seems to be working properly. Go to the program icon in your Adobe Photoshop folder, right click an
-
Restrict Purchase Order to generate custom output message on condition.
Hi Experts, We have custom message / output types ZEMA(E-Mail) & ZNEU(Standard Mail) configured for Purchase Orders. We have a requirement from client to restrict the generation of output message ZEMA, if the amount of the PO is greater than some lim
-
After configuring the Idoc to File scenario, the following error appears in the Monitor (SXMB_MONI): "Unable to find resource com/sap/xi/tf/_Vendor_Vendor_D_.class (urn:xiworkshop:groupb5:leg2leg, 8366d271-083e-11db-8dd2-f2440a114f5b," "Exception of
-
Catalog Index doesnt work on alias columns
We have a table with a text column on which we have created a catalog index. The catalog index doesnt work when I create a view of the table with alias column names. Any ideas suggestions.