ADF: How to get the attributes' values of one single row from a table?
Currently I have a table with 3 attributes, suppose A,B and C respectively. And I've added an selectionListener to this table. That means when I select one single row of this table, I wish to get the respective value of A, B and C for that particular row. How do I achieve this?
suppose the method is like:
public void selectionRow(SelectionEvent se) { //se is the mouse selection event
.......??? //what should I do to get the values of A\B\C for one single row?
Edited by: user12635428 on Mar 23, 2010 1:40 AM
Hi
Assuming you are using Jdev 11g.
Try with this
public void selectionRow(SelectionEvent se) {
String val = getManagedBeanValue("bindings.AttributeName.inputValue");
public static Object getManagedBeanValue(String beanName) {
StringBuffer buff = new StringBuffer("#{");
buff.append(beanName);
buff.append("}");
return resolveExpression(buff.toString());
public static Object resolveExpression(String expression) {
FacesContext facesContext = getFacesContext();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, expression,
Object.class);
return valueExp.getValue(elContext);
Vikram
Similar Messages
-
How to get the attribute value of an XML file??
How to get the attribute value of an XML file??
For example, how to get name and age attributes?
<student name="Joe" age="20" />What are you using to read the XML file??
On the assumption of JDOM - www.jdom.org. Something along the lines of:SAXBuilder builder = new SAXBuilder(true);
Document doc = builder.build(filename);
Element root = doc.getRootElement();
List children = root.getChildren();
Element thisElement = (Element)children.get(n);
String name = thisElement.getAttributeValue("name")
try
int age = Integer.parseInt(thisElement.getAttributeValue("age"));
catch (Exception ex)
throw new InvalidElementException("Expected an int.....");
}Ben -
How to get the attribute values out?
Hi everyone,
<root>
<category name="Mens Clothing" id="0">
<subcategory>Active/Baselayer Tops</subcategory>
<subcategory>Active/Baselayer
Bottoms</subcategory>
</category>
<category name="Womens Clothing" id="1">
<subcategory>aaa</subcategory>
<subcategory>bbb</subcategory>
</category>
</root>
How to get the attribute values out? For example "Mens
Clothing" and "Womens Clothing".
// the line below returns "Active/Baselayer Tops" and
"Active/Baselayer Bottoms"
var myXml:XML = new XML(event.result);
Thanks,
MayHere is attribute identifier operator from FB Help:
@ attribute identifier Operator
Usage myXML.@attributeName
Identifies attributes of an XML or XMLList object. For
example, myXML.@id identifies attributes named id for the myXML XML
object. You can also use the following syntax to access attributes:
myXML.attribute("id"), myXML["@id"], and myXML.@["id"]. The syntax
myXML.@id is recommended. To return an XMLList object of all
attribute names, use @*. To return an attribute with a name that
matches an ActionScript reserved word, use the attribute() method
instead of the @ operator.
Operands attributeName:* — The name of the attribute.
Example
How to use examples
The first example shows how to use the @ (at sign) operator
to identify an attribute of an element:
var myXML:XML =
<item id = "42">
<catalogName>Presta tube</catalogName>
<price>3.99</price>
</item>;
trace(myXML.@id); // 42The next example returns all attribute
names:
var xml:XML =<example id='123' color='blue'/>
var xml2:XMLList = xml.@*;
trace(xml2 is XMLList); // true
trace(xml2.length()); // 2
for (var i:int = 0; i < xml2.length(); i++)
trace(typeof(xml2
)); // xml
trace(xml2.nodeKind()); // attribute
trace(xml2
.name()); // id and color
} The next example returns an attribute with a name that
matches a reserved word in ActionScript. You cannot use the syntax
xml.@class (since class is a reserved word in ActionScript). You
need to use the syntax xml.attribute("class"):
var xml:XML = <example class='123'/>
trace(xml.attribute("class")); -
How to copy the attribute values of one instance into another instance.
Say I have 3 instances and two attributes name ,id.
inst1 : id:1 ,name:abc
inst2: id:2 ,name:bcd
inst3: id:3 ,name:efg
now I want
inst: id:1 ,name:abc
bcd
efg
i.e is need to abort instance inst2 & inst3 before that copy the names bcd & efg to inst1.
Please let me know how to do this its very urgent.Hi,
The tricky part of this is to provide your third instance a way to find the other two instances. Finding instances in a process is a bit like finding rows in a database. When doing a SELECT statement in a database, you have a primary key that will guarantee you that you'll only retrieve one row. In Oracle BPM there are a couple ways to do this. One way is to use the instance's id (the predefined variable id.id) to search for the two instances. Another is to use a "correlation" to find the instances.
This example assumes you'd like to look at instances based on a search filter. This filter assumes that you have a customerId variable that both of the instances share. It only returns those instances currently inside the process (the SearchScope logic below being set to "StatusScope.ONLY_INPROCESS" in the logic below). The only incoming variable it needs is the "customerId" variable that has already been set to some value in the other instance. Note that this uses the Fuego.Papi.ClientBusinessProcess object. This logic creates a search filter and only returns instances that meet a certain criteria (the two instances in the process). Once you get the instance, the "getVar()" method retrieves the "name" instance variable. This assumes that you have an instance variable "customerNames" defined as a String array that you are using to store the names retrieved from the two instances. The "abort()" method aborts the two instances it finds in the search.
cbp as ClientBusinessProcess = ClientBusinessProcess()
connectTo(cbp, processId : "/NameOfYourProcessHere")
instF as InstanceFilter = InstanceFilter()
create(instF, processService : cbp.processService, viewId : "TypeSearch")
instF.searchScope = SearchScope(participantScope : ParticipantScope.ALL,
statusScope : StatusScope.ONLY_INPROCESS)
logMessage "Customer Id is: " + customerId using severity = DEBUG
addAttributeTo(instF, variable : "customerId",
comparator : IS, value : customerId)
for each inst in getInstancesByFilter(cbp, filter : instF) do
// get the value of the order's amount for the instance
instanceVarValue as Object = getVar(inst, var : "name")
customerNames[] = String(instanceVarValue)
logMessage "Customer name is: " + String(instanceVarValue)
using severity = DEBUG
// aborts the instance in the process
inst.abort()
endHope this helps,
Dan -
Get the column values in a single row seperated by commas
Hi
i have two tables project_baseline and project_resource which have the foreign key project_id from the base table project_details. Now iam trying to retrieve data from these tables using the below query :
select distinct b.TASK_NAME,r.RESOURCE_NAME,() from project_baseline b inner join project_resource r on R.PROJECT_ID=B.PROJECT_ID group by b.TASK_NAME,r.RESOURCE_NAME
Below is the output snippet :
TASK_NAME RESOURCE_NAME
TEST DESIGN PARAGI M
TEST DESIGN RAJAN M S
TEST EXECUTION VIBHU ARMA
TEST EXECUTION PRATHAB GARG
TEST EXECUTION NAGABHUSHAN G K
TEST DATA PREPARATION RAJAN M S
TEST DATA PREPARATION SHIVA MARAN
TEST CASE REWORK VISWAN RAM
TEST CASE REVIEW NAGABHUSHAN G K
REGRESSION SANGEET
PROJECT SUPPORT VIBHU ARMA
PROJECT SUPPORT PRATHAB GARG
PROJECT SUPPORT PARAGI M
PROJECT SUPPORT NAGABHUSHAN G K
PROJECT SUPPORT SANGEET
PROJECT CLOSURE PRATHAB GARG
i need to get the resource_names in a single row seperated by comma for a single task like following:
TASK_NAME RESOURCE_NAME
PROJECT SUPPORT VIBHU ARMA,PRATHAB GARG,PARAGI M,NAGABHUSHAN G K,SANGEET
Could anyone please help me to get the query for the above formated output?
Thanks in advance
Meera
Edited by: 928378 on May 22, 2012 5:20 AMHi,
It can be done using xmlagg function.
For Example :
Table Data..
DEPTNO ENAME
20 WARD Tree
23 Shank
30 BLAKE
10 MILLER
30 MARTIN
10 CLARK
20 SCOTT
30 TURNER
20 ADAMS
30 JAMES
20 FORD
30 BLAKE
Query:
SELECT deptno,
RTRIM (XMLAGG (XMLELEMENT (e, ename || ',')).EXTRACT ('//text()'),
) NAME
FROM emp
GROUP BY deptno;
Output :
DEPTNO NAME
10 MILLER,CLARK
20 WARD Tree,FORD,ADAMS,SCOTT
23 Shank
30 BLAKE,TURNER,BLAKE,JAMES,MARTIN
Thanks,
Shankar
Thanks,
Shankar. -
How to get the execution time of a Discoverer Report from qpp_stats table
Hello
by reading some threads on this forum I became aware of the information stored in eul5_qpp_stats table. I would like to know if I can use this table to determine the execution time of a worksheet. In particular it looks like the field qs_act_elap_time stores the actual elapsed time of each execution of specific worksheet: am I correct? If so, how is this value computed? What's the unit of measure? I assume it's seconds, but then I've seen that sometimes I get numbers with decimals.
For example I ran a worksheet and it took more than an hour to run, and the value I get in the qs_act_elap_time column is 2218.313.
Assuming the unit of measure was seconds than it would mean approx 37 mins. Is that the actual execution time of the query on the database? I guess the actual execution time on my Discoverer client was longer since some calculations were performed at the client level and not on the database.
I would really appreciate if you could shed some light on this topic.
Thanks and regards
GiovanniThanks a lot Rod for your prompt reply.
I agree with you about the accuracy of the data. Are you aware of any other way to track the execution times of Discoverer reports?
Thanks
Giovanni -
How to convert multiple string values in a single row from nvarchar to int
suppose I have a table like below.all these values are in nvarchar. How would I find the minimum year from START_DATE??
PRODUCT_CODE
PRODUCT_DESC
START_DATE
P00002933
VITAMINE C
2005,2000,2011,2001,2002
P00003087
BIOFENAC
2011,2009,2006,2007,2004,2005
P00000155
AMOXYPEN
2006,2007,2008,2009,0000,2001
P00002325
SAHHA FARINE
2008,2003,2002,2001,2009
P00005666
AMOXYPEN
2007,2008,2006,2009,0000,2001Create the split function:
CREATE FUNCTION Split (
@InputString VARCHAR(8000),
@Delimiter VARCHAR(50)
RETURNS @Items TABLE (
Item VARCHAR(8000)
AS
BEGIN
IF @Delimiter = ' '
BEGIN
SET @Delimiter = ','
SET @InputString = REPLACE(@InputString, ' ', @Delimiter)
END
IF (@Delimiter IS NULL OR @Delimiter = '')
SET @Delimiter = ','
--INSERT INTO @Items VALUES (@Delimiter) -- Diagnostic
--INSERT INTO @Items VALUES (@InputString) -- Diagnostic
DECLARE @Item VARCHAR(8000)
DECLARE @ItemList VARCHAR(8000)
DECLARE @DelimIndex INT
SET @ItemList = @InputString
SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
WHILE (@DelimIndex != 0)
BEGIN
SET @Item = SUBSTRING(@ItemList, 0, @DelimIndex)
INSERT INTO @Items VALUES (@Item)
-- Set @ItemList = @ItemList minus one less item
SET @ItemList = SUBSTRING(@ItemList, @DelimIndex+1, LEN(@ItemList)-@DelimIndex)
SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
END -- End WHILE
IF @Item IS NOT NULL -- At least one delimiter was encountered in @InputString
BEGIN
SET @Item = @ItemList
INSERT INTO @Items VALUES (@Item)
END
-- No delimiters were encountered in @InputString, so just return @InputString
ELSE INSERT INTO @Items VALUES (@InputString)
RETURN
END -- End Function
GO
Use the below script:
create table Table1 (Product_Code varchar(50),Product_Desc varchar(10),sStart_date varchar(MAX))
Insert into Table1 Values('P00002933','VITAMINE C','2005,2000,2011,2001,2002'),
('P00003087','BIOFENAC','2011,2009,2006,2007,2004,2005')
Select Product_Code,Product_Desc ,MIN(Item) Minstart_date
From Table1 A
Cross apply Split(A.sStart_date,',') B
Group by Product_Code,Product_Desc
Drop table Table1 -
How to change the background color of a single row
Hi OTN,
I am using JDeveloper 11.1.1.2 with ADF faces in view layer.My issue is How to change the background color of a single row in af:table ?.How to highlight ADF table row based on column value?
Found by searching -
How to refer a column value of a single row in conditional column display?
Hello,
does anybody have an idea, how i can refer a column value of a single row in conditional display of a column?
So my idea is, that a report has a column, which value is only displayed, when another column value of this row has a specific value.
I want to solve this problem with condition type: PL/SQL Function Body returning a boolean.
But I do not know how to refer the column value of each single row!
Thank you,
TimHere's a solution that, to me, seems easier to implement but, that's, of course, in the eye of the implementer.
Rather than using APEX to generate a link column for you, actually create the link as part of your SQL.
select '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>' CONTACT_LINK, ...
etc.
Test this out. You'll see that it works just like making a column a link using the column attributes.
Next, we'll change the SQL to use a DECODE statement to either display the link or nothing depending on what your criteria is. For example, let's assume you only want a link for active contacts.
select Decode( CONTACT_STATUS, 'A', '<a href="f?p=102:3:491847682940364::::P3_CONTACT_ID:' || CONTACT_ID || "><img src="/i/themes/theme_1/ed-item.gif" alt="Edit"></a>', NULL ) CONTACT_LINK, ...
etc.
This will not display the link in any rows in which the CONTACT_STATUS is not active, i.e. "A"
-Joe -
In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp
Dear Friends,
TagLib how can I get the Attribute value (like JavaBean) in jsp .
I do this thing.
public void setPageContext(PageContext p) {
pc = p;
pc.setAttribute("id", new String("1") );
pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
pc.setAttribute("last_name", new String("singh"));
but in Jsp
<td>
<%=pageContext.getAttribute("first_name"); %>
cause null is returing.
Pls HELP me
with regards
Siddharth SinghFirst, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
public class MyTag extends SimpleTagSupport
public void doTag()
PageContext pc = (PageContext)getJspContext();
pc.setAttribute("first_name", "Siddharth");
pc.setAttribute("last_name", "Singh");
pc.setAttribute("id", "1");
}Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
public class MyTag extends TagSupport
public void doStartTag()
pageContext.setAttribute("first_name", "Siddharth");
pageContext.setAttribute("last_name", "Singh");
pageContext.setAttribute("id", "1");
}In each case, this sort of thing should work:
<mytags:MyTag />
<%= pageContext.getAttribute("first_name") %>I -
How to get the selected values from a selectmanylistbox?
Hi ADF Experts,
<af:selectManyListbox label="Label 1" id="sml1" partialTriggers="cb2"
value="#{viewScope.TestBean.lovValue}"
autoSubmit="true" valuePassThru="true">
<f:selectItems value="#{viewScope.TestBean.actualList}" id="si1"
binding="#{viewScope.TestBean.selectedItems}"/>
</af:selectManyListbox>
<af:commandButton text="get selected values" id="cb3"
actionListener="#{viewScope.TestBean.getSelectedValues}"
partialSubmit="true"/>
private List<String> lovValue;
private List<SelectItem> actualList;
//getters and setters
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for (String selectedItem : lovValue) {
System.out.println("Selected item: " +selectedItem.); // this is giving 1 and 3 like this. how to get the checked values as I'm getting only the indexes. In this scenario I am populating the list programmatically.Just I wanted to know how can we get the selected values(not indexes). Please suggest.
Thanks-
AbhijitHi Timo,
As I am sharing the page fragment and the Java class. So its my usecase I have mentioned below
I am sharing the jsff page fragment and java class. So that it wud be of help to others.
jsff page fragment
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core">
<af:panelGroupLayout id="pgl1">
<af:commandButton text="Search" id="cb1"
actionListener="#{viewScope.TestBean.searchSupplier}"/>
</af:panelGroupLayout>
<af:popup id="p1" binding="#{viewScope.TestBean.searchSupplierPopup}">
<af:dialog id="d2"
type="none">
<af:table value="#{bindings.Contacts.collectionModel}" var="row"
rows="#{bindings.Contacts.rangeSize}"
emptyText="#{bindings.Contacts.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.Contacts.rangeSize}"
rowBandingInterval="0"
binding="#{viewScope.TestBean.tsupportIssues}"
filterModel="#{bindings.ContactsQuery.queryDescriptor}"
queryListener="#{bindings.ContactsQuery.processQuery}"
filterVisible="true" varStatus="vs"
selectionListener="#{bindings.Contacts.collectionModel.makeCurrent}"
rowSelection="multiple" id="t1">
<af:column sortProperty="name" filterable="true" sortable="true"
headerText="#{bindings.Contacts.hints.name.label}" id="c2">
<af:outputText value="#{row.name}" id="ot1"/>
</af:column>
<af:column sortProperty="email" filterable="true" sortable="true"
headerText="#{bindings.Contacts.hints.email.label}"
id="c1">
<af:outputText value="#{row.email}" id="ot2"/>
</af:column>
</af:table>
<af:commandButton text="OK" id="cb5" partialSubmit="true" actionListener="#{viewScope.TestBean.testMethod}"/>
<af:commandButton text="Cancel" id="cb6"
actionListener="#{viewScope.TestBean.cancelPopupSearch}"/>
</af:dialog>
</af:popup>
<af:selectManyListbox label="Label 1" id="sml1" partialTriggers="cb5"
value="#{viewScope.TestBean.lovValue}"
autoSubmit="true" valuePassThru="true"
binding="#{viewScope.TestBean.prp1}">
<f:selectItems value="#{viewScope.TestBean.actualList}" id="si1"
binding="#{viewScope.TestBean.selectedItems}"/>
</af:selectManyListbox>
<af:commandButton text="get selected values" id="cb3"
actionListener="#{viewScope.TestBean.getSelectedValues}"
partialSubmit="true"/>
<af:commandButton text="remove selected" id="cb4"
partialSubmit="true" actionListener="#{viewScope.TestBean.removeSelectedValues}"/>
</jsp:root>
TestBean.java
package com.demo.view;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.component.UISelectItems;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class TestBean {
private RichTable tsupportIssues;
private List<SelectItem> lovValue;
private List<SelectItem> actualList;
private RichSelectManyListbox prp1;
private List valuesChoosed = new ArrayList();
private UISelectItems selectedItems;
private RichPopup searchSupplierPopup;
public TestBean() {
super();
public void setTsupportIssues(RichTable tsupportIssues) {
this.tsupportIssues = tsupportIssues;
public RichTable getTsupportIssues() {
return tsupportIssues;
public void testMethod(ActionEvent actionEvent) {
// Add event code here...
// For learning purposes - show Select Many Button clicked
System.out.println("Select Many Button has been Clicked");
// // RowKeySet Object can hold the selected rows from a user as follows
RowKeySet rksSelectedRows = this.getTsupportIssues().getSelectedRowKeys();
// Iterator object provides the ability to use hasNext(), next() and remove() against the selected rows
Iterator itrSelectedRows = rksSelectedRows.iterator();
// Get the data control that is bound to the table - e.g.
// OpenSupportItemsIterator
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("findAllContactsIterator");
// Information from binding that is specific to the rows
RowSetIterator rsiSelectedRows = dcIteratorBindings.getRowSetIterator();
// Loop through selected rows
int i=1;
while (itrSelectedRows.hasNext()) {
// Get key for selected row
Key key = (Key)((List)itrSelectedRows.next()).get(0);
// Use the key to get the data from the above binding that is related to the row
Row myRow = rsiSelectedRows.getRow(key);
// Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(myRow.getAttribute("name"));
valuesChoosed.add(myRow.getAttribute("name"));
// actualList = new ArrayList<SelectItem>();
// String j = Integer.toString(i);
// actualList.add(new SelectItem(j, (String)myRow.getAttribute("name")));
// i++;
searchSupplierPopup.hide();
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setLovValue(List<SelectItem> lovValue) {
this.lovValue = lovValue;
public List<SelectItem> getLovValue() {
return lovValue;
public void setActualList(List<SelectItem> actualList) {
this.actualList = actualList;
public List<SelectItem> getActualList() {
actualList = new ArrayList<SelectItem>();
if(valuesChoosed.size()!=0){
for(int i=0;i<valuesChoosed.size();i++){
actualList.add(new SelectItem(valuesChoosed.get(i), (String)valuesChoosed.get(i)));
else{
actualList.add(new SelectItem("1","Select One"));
return actualList;
public void setPrp1(RichSelectManyListbox prp1) {
this.prp1 = prp1;
public RichSelectManyListbox getPrp1() {
return prp1;
public void setValuesChoosed(List valuesChoosed) {
this.valuesChoosed = valuesChoosed;
public List getValuesChoosed() {
return valuesChoosed;
public void getValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<valuesChoosed.size();i++){
System.out.println(valuesChoosed.get(i));
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
public void removeSelectedValues(ActionEvent actionEvent) {
// Add event code here...
public void setSelectedItems(UISelectItems selectedItems) {
this.selectedItems = selectedItems;
public UISelectItems getSelectedItems() {
return selectedItems;
public void setSearchSupplierPopup(RichPopup searchSupplierPopup) {
this.searchSupplierPopup = searchSupplierPopup;
public RichPopup getSearchSupplierPopup() {
return searchSupplierPopup;
public void cancelPopupSearch(ActionEvent actionEvent) {
// Add event code here...
searchSupplierPopup.hide();
public void searchSupplier(ActionEvent actionEvent) {
// Add event code here...
RichPopup.PopupHints hints = new RichPopup.PopupHints();
searchSupplierPopup.show(hints);
package com.demo.view;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.component.UISelectItems;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichSelectManyListbox;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class TestBean {
private RichTable tsupportIssues;
private List<SelectItem> lovValue;
private List<SelectItem> actualList;
private RichSelectManyListbox prp1;
private List valuesChoosed = new ArrayList();
private UISelectItems selectedItems;
private RichPopup searchSupplierPopup;
public TestBean() {
super();
public void setTsupportIssues(RichTable tsupportIssues) {
this.tsupportIssues = tsupportIssues;
public RichTable getTsupportIssues() {
return tsupportIssues;
public void testMethod(ActionEvent actionEvent) {
// Add event code here...
// For learning purposes - show Select Many Button clicked
System.out.println("Select Many Button has been Clicked");
// // RowKeySet Object can hold the selected rows from a user as follows
RowKeySet rksSelectedRows = this.getTsupportIssues().getSelectedRowKeys();
// Iterator object provides the ability to use hasNext(), next() and remove() against the selected rows
Iterator itrSelectedRows = rksSelectedRows.iterator();
// Get the data control that is bound to the table - e.g.
// OpenSupportItemsIterator
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("findAllContactsIterator");
// Information from binding that is specific to the rows
RowSetIterator rsiSelectedRows = dcIteratorBindings.getRowSetIterator();
// Loop through selected rows
int i=1;
while (itrSelectedRows.hasNext()) {
// Get key for selected row
Key key = (Key)((List)itrSelectedRows.next()).get(0);
// Use the key to get the data from the above binding that is related to the row
Row myRow = rsiSelectedRows.getRow(key);
// Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(myRow.getAttribute("name"));
valuesChoosed.add(myRow.getAttribute("name"));
// actualList = new ArrayList<SelectItem>();
// String j = Integer.toString(i);
// actualList.add(new SelectItem(j, (String)myRow.getAttribute("name")));
// i++;
searchSupplierPopup.hide();
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setLovValue(List<SelectItem> lovValue) {
this.lovValue = lovValue;
public List<SelectItem> getLovValue() {
return lovValue;
public void setActualList(List<SelectItem> actualList) {
this.actualList = actualList;
public List<SelectItem> getActualList() {
actualList = new ArrayList<SelectItem>();
if(valuesChoosed.size()!=0){
for(int i=0;i<valuesChoosed.size();i++){
actualList.add(new SelectItem(valuesChoosed.get(i), (String)valuesChoosed.get(i)));
else{
actualList.add(new SelectItem("1","Select One"));
return actualList;
public void setPrp1(RichSelectManyListbox prp1) {
this.prp1 = prp1;
public RichSelectManyListbox getPrp1() {
return prp1;
public void setValuesChoosed(List valuesChoosed) {
this.valuesChoosed = valuesChoosed;
public List getValuesChoosed() {
return valuesChoosed;
public void getValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<valuesChoosed.size();i++){
System.out.println(valuesChoosed.get(i));
public void getSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
public void removeSelectedValues(ActionEvent actionEvent) {
// Add event code here...
for(int i=0;i<this.getLovValue().size();i++){
System.out.println("Selected Value:"+this.getLovValue().get(i));
System.out.println(this.getLovValue().remove(i));
AdfFacesContext.getCurrentInstance().addPartialTarget(prp1);
public void setSelectedItems(UISelectItems selectedItems) {
this.selectedItems = selectedItems;
public UISelectItems getSelectedItems() {
return selectedItems;
public void setSearchSupplierPopup(RichPopup searchSupplierPopup) {
this.searchSupplierPopup = searchSupplierPopup;
public RichPopup getSearchSupplierPopup() {
return searchSupplierPopup;
public void cancelPopupSearch(ActionEvent actionEvent) {
// Add event code here...
searchSupplierPopup.hide();
public void searchSupplier(ActionEvent actionEvent) {
// Add event code here...
RichPopup.PopupHints hints = new RichPopup.PopupHints();
searchSupplierPopup.show(hints);
Thanks,
A. Abhijit -
How to get the selected value in SelectOneMenu in backing bean
Hello all,
I need your help. I want to have 2 select menus with the second menu's items list are populated based on the selection in the first menu. I don't know how to get the selected value in the backing bean so that I can based on that select menu to populate the second menu's item list. Basically I need to access to the UI Component of the first select Menu and retrieve its selected value.
Could you help me out?
Thank you very much in advance,
LngoHi Lingo,
There r two ways of getting the values into the list. First one is hardcoding the values and the second one is use the list and get the values into the list by firing a query in the database.
Inorder to display the values in the second menu based on the first onces selection we need to add an attribute to the first selectonemenu known as valueChangeListener and we need to sumit the page.
Here is the sample code
<h:selectOneMenu id="catalogue"
binding="#{urbean.catalogue}" onchange="submit()"
valueChangeListener="#{urbean.categoryValueChange}"
<f:selectItem itemLabel="Select Catalogue" itemValue="" />
<f:selectItems value="#{urbean.catalogueList}" />
</h:selectOneMenu>
<h:selectOneMenu id="category"
binding="#{urbean.category}"> <f:selectItem itemLabel="Select Category" itemValue="" />
<f:selectItems value="#{urbean.categoryList}" />
< </h:selectOneMenu>
now in method called by valuechangelistener we need to write the similar code
public void categoryValueChange(ValueChangeEvent event) {
String rfnum = (String) event.getNewValue();
List categoryList = new ArrayList();
List tempList = new TablenameDAO().getActiveCatByCatalogueID(rfnum);
for (int i = 0; i < tempList.size(); i++) {
Tablename tablename = (Tablename ) tempList.get(i);
String value = "" + tablename .getrfnum();
String label = tablename .getname();
if (label == null) {
label = "";
SelectItem item = new SelectItem(value, label);
categoryList.add(item);
bean.setCategoryList(categoryList);
///getActiveCatByCatalogueID (rfnum) should bring the records which r based on the rfnum
if u follow this process i am damsure that u will get the values in to the secondlist based upon the first list
Thanks & Regards
Manidhar -
How to get the selectOneRadio value in javascript
Hi,
I want the selectOneRadio value in javascript. Can anyone give us a solution how to get the selectOneRadio value to javascript from jspx page.
Thanks,
EswariHi,
I assume you are talking about JDeveloper 10.1.3 in where there is no JavaScript API ADF Faces.Here you will have to use document.getElementById() to access the radio button component (which is a list component). You can look at the generated HTML for how the component and its ID look like.
However, what is the usecase that you cannot handle in native JSF ?
Frank -
Runtime error to get the attribute value of an element
mydoc.xml
=========
<?xml version = "1.0"?>
<persons>
<person name="Joe" age="22" />
</persons>
In mydox.xml, I want to get the attribute values of element person. Of course,
in the actual XML file, it is more complicated.
However, I get the following run-time error,
Exception in thread "main" java.lang.NullPointerException
at ParserTest.main(ParserTest2.java:18) on line element.hasAttribute("name")
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
public class ParserTest2
public static void main(String[] args) throws ParserConfigurationException, SAXException
String xmlFile = "mydoc.xml";
doc = getDocumentFromFile(xmlFile);
Element element = doc.getElementById("person");
//Exception in thread "main" java.lang.NullPointerException
if (element.hasAttribute("name"))
{ System.out.println("attribute = " + element.getAttribute("name"));
public static Document getDocumentFromFile(String xmlFile)
try
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new File(xmlFile));
return doc;
catch(IOException e)
{ e.printStackTrace();
return null;
catch(SAXException e)
{ e.printStackTrace();
return null;
catch(ParserConfigurationException e)
{ e.printStackTrace();
return null;
private static Document doc;
any ideas? Thanks!![url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/NullPointerException.html]java.lang.NullPointerException
Thrown when an application attempts to use null in a case where an object is required. These include:
Calling the instance method of a null object.
Accessing or modifying the field of a null object.
Taking the length of null as if it were an array.
Accessing or modifying the slots of null as if it were an array.
Throwing null as if it were a Throwable value.
You know what line it happens on, so you know which of these cases applies. So you know that variable "element" is null at that point. How could it come to be null? You assign to it only once, two lines above. How could that assignment be null? Check the documentation for [url http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html#getElementById(java.lang.String)]org.w3c.dom.Document.getElementById().
Repeat every time you get one of those exceptions. -
How to get the actual value rather than pixel value in vision assistant
how to get the actual value rather than pixel value by vision assistant in my program.As shown in the figure this is my programme this is the result But i want to get this result
Check the documentation for the "ADF Dialog Framework"
It may help
Atilio
Maybe you are looking for
-
This has probably been answered. Please link me to the solution if its been addressed already. Data Merge Indesign CS2 crashes once I click "Create Merge Document" Process: Adobe InDesign CS2 [94022] Path: /Applications/Adobe InDes
-
Object output/ input to File
I'm writing an Object to a file. This class has 10 variables, and 20 methods. The methods are just for setting and getting values. MyClass temp = new MyClass(); --- Code used to write --- I Set all Variables in temp -- then OOS.writeObject((MyClass)t
-
Email says "Copying to Outbox" for hours.
I am trying to send an email with a compressed .zip 15gb exported Final Cut Pro X movie to an address, but when I click send it closes the window like normal, but it doesn't appear in the sent box. I click Window > Activity and see the process Copyin
-
I am a student and am considering the purchase of Photoshop CS6 Extended Student and Teachers Edition. My current OS is Mac OSX Snow Leopard, but in the future will be upgrading to OSX Lion or Mountain Lion. Can anyoine tell me if this version of Pho
-
HT1343 How do I select multiple items?
How do I highlight and select multiple items?