JSF: Problems adding rows to table with custom method

Since this being my first post, I find it only appropriate to thank the development team for such a huge addition to the application development world. You guys rock. You have cured my Java identity crisis. That being said...
I have been stumped for days. I'm making a simple web cart. I am trying to get two string values (name and price) passed through a custom exposed application module method ran on a backing bean. What I want the exposed VO module to do is, upon receiving the two strings, create a new row on the empty data controlled table I have built to store them. Basically I just need to add rows to a table with my custom managed bean. Most recent version.
I have written a test method to make sure my backing bean and exposed app module impl were working. This test works:
//WORKS
//CartInfo.java   
    public String cb1_action() {
        AppModuleImpl am = new AppModuleImpl();
        am.testMethod();
        return null;       
//AppModuleImp.java
    public void testMethod() {
        System.out.println("WORKS");      
    }I found some code on how to add rows and unfortunately it isn't working out for some reason. Here is what is producing the error "Caused By: java.lang.NullPointerException" :
//DOESN'T WORK IN CUSTOM METHOD BUT WORKS WHEN DRAGGED ON TO THE PAGE AS A COMMAND BUTTON
//CartInfo.java
    public String cb1_action() {
        AppModuleImpl am = new AppModuleImpl();
        am.testMethod("test", "test");
        return null;
//AppModuleImp.java
       public void testMethod(String pName,String pPrice) {
        ViewObjectImpl vo = this.getCartVO1();
        Row r = vo.createRow();
        r.setAttribute("NAME", pName);
        r.setAttribute("PRICE", pPrice);
        vo.insertRow(r);
//The VO attributes for the DC are:
// Name : Type : Alias Name : Entity Usage : Info
NAME : String : NAME : (blank) : Transient
PRICE : String : PRICE : (blank) : TransientSo what I have so far is a table linked to my database. A user can select and click on a product on the row's individual Add button and using a modified selection listener, it returns the values to the backing_bean.
Then what I want it to do is have those variables passed to the other table. I just can't put it together.
Please if there is anyone that could send me in the right direction I would greatly appreciate it!
Thank you,
Jack

if i understand you, you want to call application module method when user clicks on add button on the UI and your table is from VO
so what i can come up for now is:
1) create variable binding from the iterator for both name and price.
2) on your UI action button :
<af:commandButton actionListener="yourbean.addToCart">
<f:attribute name="pName" value ="binding.<created name bind variable>"
<f:attribute name="pPrice" value = "binding.<created price bind variable>"
</af:commandButton>
3) custom Managed Bean:
//yourBean.java
public void addToCart(ActionEvent e){
// get binding here
// use executeWitParams method to send parameter to the function "testMethod" and execute
//AppModuleImp.java
public void testMethod(String pName,String pPrice) {
CardVOImpl vo = this.getCartVO1();
CardVORowImpl r = (CardVORowImpl)vo.createRow();
r.setAttribute("NAME", pName);
r.setAttribute("PRICE", pPrice);
vo.insertRow(r);
Hope this helps...
Let me know if not..
Thanks
Edited by: MavenDev on Oct 30, 2011 8:08 PM

Similar Messages

  • Problem in updating FPLT Table with custom fields of the billing plan

    Hi Guys
    I have a requirement to add 2 custom fieldd in the billing plan tab of sales order and I could not find any screen exit for that. However I got access key and added those 2 fields on the screen but I am not able to uodate table FPLT from there.
    I can see exits to pass the value but because there is no screen exit, the program cant retain the values keyed given by use on the screen.
    I really dont know where do I need to write the code and how to make screen fields read by the program.
    Please please help.
    Thanks a lot

    Hi,
    Probably too late, but here's the solution:
    - Transaction SE51 program: SAPLV60F and dynpro number: 0030
    - Goto 'Logical execution' or something like that (i'm connected in french)
    -  Modify standard code line 75: here I have added the field 'LIBEL'
        FIELD:
          FPLT-FAKSP,
          FPLT-FAREG MODULE FPLT-FAREG_PRUEFEN ON REQUEST,
    *{   REPLACE        DTAK910958                                        1
    *\      FPLT-FPTTP.
          FPLT-FPTTP,
          FPLT-LIBEL.
    *}   REPLACE
        CHAIN.
    Il means that field LIBEL will be checked with field FPTTP.
    regards.

  • ORA-00600 problem when create XMLType table with registerd schema

    Hi,
    I am using Oracle9i Enterprise Edition Release 9.2.0.4.0 on RedHat Linux 7.2
    I found a problem when I create table with registered schema with follow content:
         <xs:element name="body">
              <xs:complexType>
                   <xs:sequence>
                   </xs:sequence>
                   <xs:attribute name="id" type="xs:ID"/>
                   <xs:attribute name="class" type="xs:NMTOKENS"/>
                   <xs:attribute name="style" type="xs:string"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="body.content">
              <xs:complexType>
                   <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:element ref="p"/>
                        <xs:element ref="hl2"/>
                        <xs:element ref="nitf-table"/>
                        <xs:element ref="ol"/>
                   </xs:choice>
                   <xs:attribute name="id" type="xs:ID"/>
              </xs:complexType>
         </xs:element>
    Does Oracle not support element reference to other element with dot?
    For instance, body -> body.content
    Thanks for your attention.

    Sorry, amendment on the schema
         <xs:element name="body">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="body.head" minOccurs="0"/>
                        <xs:element ref="body.content" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="body.end" minOccurs="0"/>
                   </xs:sequence>
                   <xs:attribute name="id" type="xs:ID"/>
                   <xs:attribute name="class" type="xs:NMTOKENS"/>
                   <xs:attribute name="style" type="xs:string"/>
              </xs:complexType>
         </xs:element>

  • Problem when updating af:table with new records

    Hi,
    I have a page that shows two tables from the same DB table but with different VOs.
    Table1 displays records where date_column is within the current month, table2 displays all records.
    The problem is that when I add new record and return to the page, I find out that the new record has been added to both tables, it’s shown in table1 even though its date is not within this month.
    When I run the page again the problem is solved and everything is in the right place !!
    How can I fix this?

    Hi,
    you will have to re-query the iterators because you add the new row to a VO - which is an iterator - that wont filter your input (instead you add to a filtered iterator). However, its strange that both tables show that value because if these are different VO they should be independent. Only if they are instances of the same VO tehy are expected to show the same data
    Frank

  • [Solved]Problem in showing ADF tables with 50,000 Records and more in TP4

    Hi,
    When I tried to view readonly ADF table in TP4, it loaded perfectly, but when i tried to run the vertical scrollbar to bottom record, it showed Fetching Data .... for few minutes and finally it showed a message. java.lang.OutOfMemoryError: Java heap space.
    When I tried to view normal ADF table in TP4, it loaded perfectly, but when i selected one row a popup Error message came and reported all the columns in the table with java.lang.NullPointerException.
    Similar functionality works beautifully in JDeveloper 10g version. Seems to be a serious problem in handling cached rows.
    Regards,
    Santhosh
    I am also getting a warning in OC4J console as given below:
    WARNING: Application loader current-workspace-app.web.SRApplication-ViewController-webapp:0.0.0 may not use /D:/Appl/jdevstudio1111/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Appl\jdevstudio1111\j2ee\home\oc4j.jar)
    Message was edited by:
    Santhosh1234
    Message was edited by:
    Santhosh1234

    Hi!
    You have two ways:
    1. build your own table CollectionModel that will use TopLink paged data source access (see Pedja's thread here Paging of large data sets - SOLUTION
    2. use new Paged EJB finders that started to appear with TP4 when you use wizard to generate SessionBeans (named something like "query<Entity>FindAllByRange") . I posted already question about this new paged finders here How to use new "query<Entity>FindAllByRange" EJB finders? but no answers from devs yet :)
    Personally, I opt for no. 2 (paged finders) as it looks more platform-supported that writing custom CollectionModels for each finder... But until devs enlighten us with details how the paged finders are to be used (the af:table is not [yet?] supportive for drag-and-drop of paged finders), we are stuck with 1. option.
    Regards,
    Pavle

  • How to view added rows in table; there is a horizontal line below which any added rows disppear!  Pages version 5.1 which I DESPISE!!!!

    I just replaced Pages after paying Apple $400+ for replacing a wiped-out hard-drive....
    MANY HORRIBLE QUIRKS with Pages 5.1...
    the one I listed above.....it's as if there is only one page....I can't see any added rows in the table below this arbitrary line drawn across the bottom!  I can ADD the rows, but nothing I type in them is visible!

    Do you have Pages '09 in your Applications/iWork folder?
    If not ask Apple to give it to you again.
    You own it.
    Peter

  • Understanding logminer results -- inserting row into table with CLOB field

    In using log miner I have noticed that inserts into rows that contain a CLOB (I assume this applies to other LOB type fields as well, have only tested with CLOB so far) field are actually recorded as two DML entries.
    --the first entry is the insert operation that inserts all values with an EMPTY_CLOB() for the CLOB field
    --the second entry is the update that sets the actual CLOB value (+this is true even if the value of the CLOB field is not being set explicitly+)
    This separation makes sense as there may be separate locations that the values are being stored etc.
    However, what I am tripping over is the fact the first entry, the Insert, has a RowId value of 'AAAAAAAAAAAAAAAAAA' which is invalid if I attempt to use it in a flashback query such as:
    SELECT * FROM PERSON AS OF SCN #####'  where RowId = 'AAAAAAAAAAAAAAAAAA'The second operation, the Update of the CLOB field, has the valid RowId.
    Now, again, this makes sense if the insert of the new row is not really considered "+done+" until the two steps are done. However, is there some way to group these operations together when analyzing the log contents to know that these two operations are a "+matched set+"?
    Not a total deal breaker, but would be nice to know what is happening under the hood here so I don't act on any false assumptions.
    Thanks for any input.
    To replicate:
    Create a table with CLOB field:
    CREATE TABLE DEVUSER.TESTTABLE
            ID NUMBER
           , FULLNAME VARCHAR2(50)
          , AGE NUMBER  
          , DESCRIPTION CLOB
           );Capture the before SCN:
    SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Insert a new row in the test table:
    INSERT INTO TESTTABLE(ID,FULLNAME,AGE) VALUES(1,'Robert BUILDER',35);
         COMMIT;Capture the after SCN:
    SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Start logminer session with the bracketing scn values and options etc:
    EXECUTE DBMS_LOGMNR.START_LOGMNR(STARTSCN=>2619174, ENDSCN=>2619191, -
               OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE + -
               DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.NO_ROWID_IN_STMT + DBMS_LOGMNR.NO_SQL_DELIMITER)Query the logs for the changes in that range:
    SELECT
           commit_scn, xid,operation,table_name,row_id
           ,sql_redo,sql_undo, rs_id,ssn
           FROM V$LOGMNR_CONTENTS
        ORDER BY xid asc,sequence# ascResults:
    2619178     0C00070028000000     START                  AAAAAAAAAAAAAAAAAA     set transaction read write
    2619178     0C00070028000000     INSERT     TESTTABLE     AAAAAAAAAAAAAAAAAA     insert into "DEVUSER"."TESTTABLE" ...
    2619178     0C00070028000000     UPDATE     TESTTABLE     AAAFEXAABAAALEJAAB     update "DEVUSER"."TESTTABLE" set "DESCRIPTION" = NULL ...
    2619178     0C00070028000000     COMMIT                  AAAAAAAAAAAAAAAAAA     commitEdited by: 958701 on Sep 12, 2012 9:05 AM
    Edited by: 958701 on Sep 12, 2012 9:07 AM

    Scott,
    Thanks for the reply.
    I am inserting into the table over a database link.
    I am using the new version of HTML Db (2.0)
    HTML Db is connected to an Oracle 10 database I think, however the table I am trying to insert data into (via the database link) is in an Oracle 8 database - this is why we created a link to it as we couldn't have the HTML Db interacting with the Oracle 8 database directly due to compatibility problems (or so I've been told)
    Simon

  • How I can insert one row on table,  with columns settings: readonly = true

    I have a problem. (jdeveloper 11.1.1.2.0)
    How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
    When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
    I make double click, then output text is visible (ReadOnly = false)
    I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
    Thanks

    Hi,
    try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
    Frank

  • Need to create a new row in table with same data as Primary key, but new PK

    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kale

    user9970447 wrote:
    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kalesomething like
    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')

  • Problem using multiple choice LOV with custom attribute in IAS 10.1.2.0.2

    Hi
    When aplying a multiple choice and selecting multiple selection and saving in the content area , everything looks fine .
    However when looking at the page the selection is only the first one selected and not the miltiple choices I made
    can someone tell me what is going on , does the miltiple selection with custom attribute
    works ??
    thanks in advance
    Igal

    Hi there,
    I don't really understand what you're doing but I used lot of LOV in custom attributes on my custom items and everything works fine.
    Can you explain more your problem ?

  • Adding & updating user tables with DI

    Hi, how to I add & update records of a user defined table with DI? Is there an object for this, or do I just do a DoQuery(insert etc) ?
    Thank you.
    Jose.

    Hi José,
    In the DI API you can use the UserTable object to add, update or delete records as long as the user table is not part of a UDO.
    Example:
    // Link to the UDT - Note: table name does not include @ prefix
    SAPbobsCOM.UserTable sboTable = (SAPbobsCOM.UserTable)_sboCompany.UserTables.Item("Test2");
    // To add a record
    sboTable.Code = "12345678"; // must be unique
    sboTable.Name = "My New Record";
    sboTable.UserFields.Fields.Item("U_MyUDF").Value = "TEST";
    if (sboTable.Add() != 0)
        _sboApp.SetStatusBarMessage("Record add failed: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
    else
        _sboApp.SetStatusBarMessage("Record added successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
    // To update a record
    if(sboTable.GetByKey("12345678"))
        sboTable.UserFields.Fields.Item("U_MyUDF").Value = "UPDATED";
        if (sboTable.Update() != 0)
            _sboApp.SetStatusBarMessage("Record update failed: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
        else
            _sboApp.SetStatusBarMessage("Record update successfully.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
    else
        _sboApp.SetStatusBarMessage("Record 12345678 not found.", SAPbouiCOM.BoMessageTime.bmt_Medium, true);
    Kind Regards,
    Owen

  • Sorting table with custom function

    Hi,
    I am using JDev 11.1.1.4.0
    I have a table with records.
    public Record(int id, String desc) {
    this.id = id;
    this.description = desc;
    I want to implement a sorting function, for the description column, based on the length of the String.
    Any ideas how to do it?

    Hi Pedro,
    In that case the class Record should be "comparable" as you said.
    You can replace the current collection by an ordered list/set, and then implement the interface Comparator.
    This is an example:
    public java.util.TreeSet<Record> getRecords() {
      TreeSet<Record> records = new TreeSet<Record>(new RecordComparator());
      // routine to get the records
      return records;
    class RecordComparator implements Comparator<Record> {
      @Override
      public int compare(Record o1, Record o2) {
        // be careful with null records/attributes!
        return o1.getDescription().length() > o2.getDescription().length() ? 1 : o1.getDescription().length() < o2.getDescription().length() ? -1 : 0;
    }After that, try this:
    http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/
    AP
    Correction:
    Just add a transient attribute to class Record and try this with that new attribute: http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/
    AP
    Edited by: Alejandro Profet on Nov 12, 2012 3:32 PM

  • Word VBA Macro problem with adding rows to table for BAPI call

    Hello all,
    I have code in Word macro which is reading file from the disk and converting it to binary. This binary should be inserted in the internal table (Dim As object) for further posting. Code is modified from the note 945682.
    Here is the code:
    Sub Read_File(FileNameFull As String)
    Dim oBinaryDataTab As Object
    Dim oBinaryDataRow As Object
    Dim lBytesToRead As Long
    Dim iNumChars, i As Integer
    Dim s1022, s2044, sX As String
    Dim fs, f, ts As Object
    Dim ReadFile As String
    ' Actually does the work of uploading the document in 1022 byte pieces.
    ReadFile = 0
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(FileNameFull)
    Set ts = f.OpenAsTextStream(1, -2)
    lBytesToRead = f.Size
    ReadFile = f.Size
    Do While ts.AtEndOfStream <> True
    If lBytesToRead < 1022 Then
    iNumChars = lBytesToRead
    Else
    iNumChars = 1022
    End If
    s1022 = ts.Read(iNumChars)
    s2044 = ""
    For i = 1 To Len(s1022)
    sX = Hex$(CByte(Asc(Mid(s1022, i, 1))))
    If Len(sX) = 1 Then
    sX = "0" + sX
    End If
    s2044 = s2044 + sX
    Next i
    Set oBinaryDataRow = oBinaryDataTab.Rows.Add
    oBinaryDataRow("LINE") = s2044
    lBytesToRead = lBytesToRead - iNumChars
    Loop
    End Sub
    But on the row "Set oBinaryDataRow = oBinaryDataTab.Rows.Add" code just stopped to work.
    Can somebody give me a hint how to proceed?
    I also tried to Dim oBinaryDataTable As Table and oBinaryDataRow as Row with the same result.
    oBinaryDataTable will be used as to post file to SAP system without GUI FTP connection. Because of that it must be converted to binary form.
    TIA
    Gordan
    P.S. Message to Moderator: Please, be so kind, and put the message in the proper forum if this is not this one.

    Self Resloved

  • Highlighting corresponding rows in table with mouseover

    I have a requirement where I need to highlight multiple rows that are logically grouped together in a table. I was thinking of accomplishing this by:
    1. Add an invisible column to the table.
    2. Set the column's StyleClass in the code to some indicator.
    3. Add a client listener to the table/row?? of type mouseover to identify the row being hovered over.
    4. In Javascript, select all the rows that have the same StyleClass as the row being hovered over and set their background color.
    I am having trouble with step #3 because I am unable to add the client listener to a table/row to identify the row that is hovered over. Note that the user is not clicking on the row so I cannot use the "current row".
    If there is no way to identify the row, is there any other way to highlight multiple rows on mouseover?
    I am using JDeveloper 11.1.1.5.
    Thanks.

    Hi Frank, I tried adding the clientListener to each cell renderer component but the problem I noticed with that was that the cell components do not always occupy the entire width of the column so the user has to hover over the cell which may be a tiny part of the cell.
    I did however find an alternate solution using JQuery. So instead of adding the client listeners to each component, I added a JQuery .hover() function on document load. Below is the javascript that is loaded on the page load.
    <af:resource type="javascript">
    function initialize()
    //the class name that will be looked at in the DOM and highlighted
    var classToHighlight = "";
    //TODO will need to use .live("hover") if using PPR on the page
    $('.columnClass').hover(
    function(data)
    $($(this).attr('class').split(' ')).each(function()
    if (this !== '')
    if ( this.indexOf("bgHighlightClass") == 0 )
    classToHighlight = this;
    $("." + classToHighlight).css('background-color', 'orange');
    function(data)
    $("." + classToHighlight).css('background-color', 'white');
    classToHighlight = "";
    </af:resource>
    <af:clientListener method="initialize" type="load"/>

  • How to hightLight selected row in table with version 10.1.3 ADF

    Hi there
    I am experiencing a difficulty in getting the radio selected table row to be highlighted with 10.1.3 Jdeveloper.
    i had looked it an example from this blog --
    http://adf-rk.blogspot.com/2007/01/adf-oracle-form-like-overflow-in-adf.html
    it worked, but the problem is that it does highlight the table cell's data background , but it doesn't hightlight the whole row.
    can anyone have any idea of how to get the whole row working?

    By setting the server platform,
    <server-platform xsi:type="oc4j-1012-platform">
    </server-platform>
    you are enabling JTA integration and the external transaction controller. So if your data-source "jdbc/OracleDS" is a JTA datasource and the JTA transaction is being set to roll back then the insert should not get committed.
    Verify that you are not trapping the exception further up causing the SessionBean not to rollback the transaction. Also turn on TopLink logging to verify what is occurring.
    The active UnitOfWork uses the default connection pool, so your
    <name>NamedConnectionPool</name>
    is not required unless you are using it some other way?
    Also when using JTA "uow.commit();" is not required, the JTA transaction is responsible for committing the unit of work.

Maybe you are looking for

  • Not able to sync

    Itunes deleted all the songs on my ipod (nano generation-2), and i can't re-sync it. ..Everytime i try to, the message "Songs on the ipod cannot be synced because all the playlists selected for syncing no longer exist." comes up ...can someone please

  • Add a JLabel below a JTextArea in a boxlayout

    I have a JTextArea in a JScrollPane in a GUI, and I'm using BoxLayout. Occasionally, I wish to add a JLabel to my JScrollPane, which works fine. However, since my BoxLayout is set to the Y_Axis layout, the JLabel always ends up being centered below t

  • RH 8 Hangs When Upgrading/Importing RH 6 Project

    I have a project I created in RH 6 that I am attempting to upgrade to RH 8. When I open the RH 6 project in RH, I get the dialog that tells me the project was created in an older version of RoboHelp and that in order for me to open the project in Rob

  • Getting the full file path from FormFile

    Hi, I am reading in a .csv file from my JSP page and I want to pass the String path from my Action class to the logic layer class. When I try and pass it at the moment, it throws an FileNotFound error as it is only passing the file name. i.e Passing

  • How NOT to restrict no of rows from two tables

    I have two identical tables Invoice and Payment. The only difference is Invoice_id,Invoice_Amt and Payment_id,Payment_Amt columns that shows different ids and amounts. The bank_ids, names, account_types are same. Invoice table has 3 rows and Payment