Netbeans dataprovider JSF page with data table

I have crated a database very similar to the one that is shown as an example on the Netbeans site tutorial Insert, Update, Delete. Except that the table doesnt have any linking dropdown list that controls the information displayed on the table. It connects to an oracle database. The table has 4 columns, all of which are editable text fields. THey participate in a virtual form with a save changes button i have. I also have an insert button on the page which adds an extra row to be populated. When a new row is created and saved I set a CREATER DATE AND CREATE USER field as well. Currently I have all of this working.
My issue is I need to add code to my savebutton action code so that it checks if any of the existing entries in the database, any of the fields were changed. And if so I need to set UPDATE DATE and UPDATE USER fields for the respective row. What I dont understand is how I check once the user hits the save button the submited changes against the values already in the database. Below is my save button code. (The TRANSFR_AGENTID code is to set the primary incrementing key for new entries).
public String savebtn_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
//Navigate through
try {
//if (trnsfr_agentDataProvider.getRowCount() > 0){
// trnsfr_agentDataProvider.cursorFirst();
CachedRowSetDataProvider maxTransID = getSessionBean1().getMaxTrnsfrAgentIDDataProvider();
maxTransID.refresh();
maxTransID.cursorFirst();
java.math.BigDecimal num1, num2;
java.math.BigDecimal newTransId = ((java.math.BigDecimal) maxTransID.getValue("MAXTRNSFR_AGENTID"));
System.out.println("###### newTransID = " + newTransId);
if (newTransId == null){
newTransId = new java.math.BigDecimal(1.0);
System.out.println("###### after null if comparison newTransID = " + newTransId);
num1 = new java.math.BigDecimal(1.0000);
num2 = new java.math.BigDecimal(-1.0000);
if (trnsfr_agentDataProvider.getRowCount() > 0) {
trnsfr_agentDataProvider.cursorFirst();
do {
if (trnsfr_agentDataProvider.getValue("TRNSFR_AGENT_ID").equals(new Double(0))) {
trnsfr_agentDataProvider.setValue("TRNSFR_AGENT_ID", (java.math.BigDecimal) newTransId);
newTransId = newTransId.add(num1);
} while (trnsfr_agentDataProvider.cursorNext());
trnsfr_agentDataProvider.commitChanges();
} catch (Exception ex) {
log("Error Description", ex);
error("Error :" + ex.getMessage());
return null;
}

http://www.oracle.com/technology/products/jdev/101/howtos/jsfdrilldown/index.html

Similar Messages

  • Must a EntityBean map with data table?

    I know Not every data table will map with Entity bean
    but must a EntityBean map with a datatable?
    rgds

    Ofcourse Not, EntityBean Just A style of Bean,
    We declare something as EntityBean because it perform some action like a Entity
    For Example,A Man Contain some attribute, or A File with some attribute,
    usually we have store this in the database ,so EntityBean Usually map with data table.
    but you can also store the data in the file format as you like,you can control it in the BMP model
    in my opinion ,Entitybean is the object base on the attribute , the Sessionbean is the object base on the action with the user.So we can distinguish them��:-)

  • Problem connecting JSF page with SQL server 2005 DB

    hello guys,
    i have tried working with the visual web JSF in NET BEANS 6.1 IDE.
    i get an error connecting the jsf page witht he sql server 2005 db.
    i get an odbc:jdbc error.
    can anyone gimme the exact correct coding to connect a a jsf page with the sql server 2005 db.
    expecting a reply soon...
    thanks a lot....
    sandeep

    You need to elaborate a bit more about the problem.
    Read this to get more chance on suitable help: [http://www.catb.org/~esr/faqs/smart-questions.html].

  • Inserting values into multiple tables in one jsf page with single commit op

    hi all,
    i have two tables ,
    one is parent table and other is child record.
    record details:
    table1:(parent table)
    emplid (primary key)
    empl_name
    table 2:(child table)
    empl id ( Foreign key)
    empl_name ( Foreign key)
    contact_no (primary key)
    my senario is , i need insert values into both parent and child table in one save option.
    and both the tables will be in one jsf page.
    is this possible to do?
    thanks all,
    regards,
    M vijayalakshmi

    hi,
    i feel my question is not clear.
    let me explain my question clearly.
    1. i have two records
    *1. emp_names*
    attributes of this table is 1.emplid
    2.emp_name.
    emplid is a primary key.
    2. emp_contact
    attributes of this table is 1.emplid
    2. contact_no
    In this table emplid is forigen key from emp_name table
    contact_no is primary key.
    and my senerio is,
    for one emplid there are many contact no.
    in database diagram i have created these two entities. and from that i have generated two views objects.
    now in jsf page ,
    i shd have all fields from both the records.
    wn ever i click on add button , i shd be able to insert one complete row of data to both the tables.
    means,
    emplid
    empl_name
    contact_no.
    and if i click on commit button data shd be insert in both the tables.
    so how to achive this?
    am very beginner to the jdeveloper tool.
    regards,
    m vijayalakshmi.

  • Odd/Even pages with data from two tables

    Hi Forum,
    Can you please extend help/suggest with the following scenario:
    I have two data tables and one table records needs to be printed on odd pages (Front page) and the other table records need to be printed on even pages (Back page). I need alternating front and back pages based on data records in the tables. Also second table will be having lesser records when compared with first table.
    I'm able to get the alternating Odd/Even master pages. But the first table is being printed in both the odd/even pages first and then the second table is being printed in both the odd/even pages. How can I restrict the printing of the first table on odd page and second table on even page?
    Thanks for your help/suggestions.
    ~Madan

    You can play with pagination tab in your LCD tab, but I have never learnt enough to be able to use it effectively.
    If I were in your shoes, I would alter the DDIC structures in the backend so you will only display it in the form, without any suicidal actions through the pagination, scripting or similar stuff.
    How: If you need to alter pages, you can do that in your backend, right?
    Like you can have a structure page with attributes:
    - up/ front: data for the front page
    - down/back: data for the back page
    and you will alter the data in the table with this structure as a line in your ABAP program and will use to form to display the trnaformated data only.
    Well... I don´t tell it is clear/right/ proper solution and cannot tell if there are any obstacles which will not let you use this scenario in your case, but you could consider this as an option...
    Regards Otto

  • Expand All and Collapse All with Data table

    Hi Guys,
         I have a data table as shown in code pasted . where the first and second column have row category which gives a categorization with a twisty.
         When i click on the twisty or item name the level beneath it expands. Eerything works fine.. but i need to have to links     Expand All and Collapse All which when clicked open the entire hierarchy or collapse it. Can anyone suggest a way of doing. Can it be done using javascript, I am not comfortable with java script .If someone has done this before please share the piece of code.Also please suggest the different ways of doing it. I am using RAD 7 and IBM JSF components.
         <hx:dataTableEx border="0" cellpadding="2" cellspacing="0"
         columnClasses="columnClass1" headerClass="headerClass"
         footerClass="footerClass" rowClasses="rowClass1, rowClass2" binding="#{masterPublList.tablebindData}"
         id="tableEx1" styleClass="dataTableEx" value="#{masterPublList.lst_publication}" var="varlst_publication">
              <hx:columnEx id="columnEx3">
                   <hx:panelRowCategory id="rowCategory2"
                        styleClass="panelRowCategory"
                        value="#{varlst_publication.publCategory}" collapsed="true">
                   </hx:panelRowCategory>
              </hx:columnEx>
              <hx:columnEx id="columnEx2">
                   <hx:panelRowCategory id="rowCategory1"
                        styleClass="panelRowCategory" value="#{varlst_publication.publSubCategory1}">
                        <h:outputText id="text5" styleClass="outputText"></h:outputText>
                   </hx:panelRowCategory>
              </hx:columnEx>
              <hx:columnEx id="column1">
                   <hx:outputLinkEx id="linkEx1" styleClass="outputLinkEx" value="#{varlst_publication.publUrl}" target="_blank">
                        <h:outputText id="text3" styleClass="outputText" value="#{varlst_publication.publName}"></h:outputText>
                   </hx:outputLinkEx>
              </hx:columnEx>
              <hx:columnEx id="columnEx1">
                   <h:selectManyCheckbox disabledClass="selectManyCheckbox_Disabled"
                        id="checkbox1" styleClass="selectManyCheckbox" value= "#{varlst_publication.publLang}">
                        <f:selectItems value= "#{masterPublList.lst_lang}"/>
                   </h:selectManyCheckbox>
              </hx:columnEx>
         </hx:dataTableEx>
                   Thanks in anticipation

    Hi Naamkeek,
    Per my understanding that you have added the Expand All and Collapse All button in an drill down report by adding the "Go to report" action, now you got the report always refresh and return to the first page, right?
    I have tested on my local environment and can reproduce the issue, no matter whether to add two buttons or using the parameter to do the Expand All and Collapse All, it is always return to the first page.
    Gernerally, SQL Server Reporting Services does a postback while clicking a expand/collapse icon. SSRS re-renders reports because it need to regenerate the pages to fit the defined width & Height. That is why SQL Server Reporting Services reloads
    the whole report.
    This is by design. And, currently, we are not able to turned it off.
    I would suggest you submitting a wish at
    http://connect.microsoft.com
    If the service requests frequently, we may include it in the next release.
    Appreciate your understanding, and if you have any more questions, please feel free to ask.
    Regards
    Vicky Liu

  • Rendering a JSF page with a choice from CoreSelectOneChoice!

    Hi,
    I have a jsp page with lots of ADF and JSF components. I have a CoreTable component that gets it values from a DB thru Toplink. On this page I have a CoreSelectOneChoice component with a ValueChangedListener. When the user makes a selection from the CoreSelectOneChoice component I want the CoreTable to update its value based on code in the ValueChangeListener.
    My problem is that when the user makes its selection on the CoreSelectOneChoice component my CoreTable dont renders out from the new values I set in the ValueChangedListener.
    So how can I render (re-post) my CoreTable component or my whole page after the code in my ValueChangedListener has run? Or what code should I put in the ValueChangedListener to get the wanted behavior.
    Hope that sombody can help a stuck developer :-)
    Eskild

    Hi,
    set autosubmit = true on the core selet one component and define an ID value. On the table component, set the PatrialTriggers property to the ID value
    Frank

  • How to create search engine in JSF page with AJAX

    I want to create Java Server Faces page with search engine using AJAX. I'm interested can I do this with PL/SQL statement which searches strings into all Oracle tables at database level? What are the best practices in this case?

    user10484841 wrote:
    I want to create Java Server Faces page with search engine using AJAX.
    I'm interested can I do this with PL/SQL statement which searches strings into all Oracle tables at database level? I give up.
    Can you?
    What are the best practices in this case?Best practice is to know where data is stored to avoid search of all Oracle tables.

  • Help with data table

    I am a new user of LookoutDirect and as luck would have it I need to
    use a Data Table.  I have spent the better part of a month tying
    to get it setup.  I found an example on this website which does
    exactly what I want to do and still can't get it figured out. 
    There just seems to be some things that are not explained in any of the
    manuals.  I think I have it worked down to a few very specific
    questions.  I have most of my application going but this data
    table has me by the throat.  Should I just post the questions on
    here or try to get hooked up with someone to assist me?
    thanks

    Yes, you can post the questions here. Also tell us which example you found on the website, and which part you don't understand.
    Ryan Shi
    National Instruments

  • IGS graph with data table

    Hi all,
    I'd like to create an image of a graph with a data table below that contains the data displayed by the graph.  I know this is possible as of SP 8 of IGS 6.40, but I can't find anywhere any documentation on how I can pass this on to the Chart Element of the Graphics extension.
    Does anyone know what I should put in my custom XML or any other way of obtaining this result?  Any pointers to documentation that could get me on the right track would also be appreciated.
    Thanks,
    Tim

    Hi Kai,
    I had indeed seen that note about BW, so I thought the IGS was capable of doing it. I just had to do a similar call as BW.  Too bad this isn't supported.
    Anyways, thanks a lot for your answer.  I won't waiste my time looking for a way to do this anymore now.
    Thanks,
    Tim

  • Refresh page with data from the Next Record in the Table through a Button

    Scenario: Record of a table “prototype” is made up of 8 columns,
    key_col,
    text_col,
    label1_col, label2_col, label3_col,
    check1_col, check2_col, check3_col,
    I have created the following items on a page:
    a) A Display Only item that is populated through a SQL query
    “SELECT text_col from prototype where rownum=key_seq.NEXTVAL “.
    b) Hidden item for the database columns “label1_col, label2_col, label3_col”
    Source type for the hidden items is of type SQL query, Source expression is:
    Select label1_col from prototype where rownum=key_seq.NEXTVAL ;
    Select label2_col from prototype where rownum=key_seq.NEXTVAL ;
    Select label3_col from prototype where rownum=key_seq.NEXTVAL ;
    (key_seq is a sequence).
    c) Checkbox item for the database columns “ check1_col, check2_col,check3_col"
    d) The labels for the above checkbox items are &label1_col. , &label2_col. , &label3_col.
    I have created a Save button to save the state of the checkboxes; (STATIC:;1 )
    I want the page to be refreshed with the data from the next record (Fields text_col, label1_col, label2_col, label3_col) through a “ Next” Button.
    Can I please know how I can achieve this?
    Thanks in advance

    If you need the value that is entered in the textbox as the email body, then try this..
    <html>
    <HEAD>
    <title>WebForm1</title>
    <script language="javascript">
    function mailHTML() {
    var content=document.getElementById('textBox').value;
    location.href="mailto:?body="+encodeURI(content);
    </script>
    </head>
    <body>
    <form name="theform" id="theform">
    <div name="body1"/>
    <input type="text" value="Test" id="textBox"/>
    <input type="button" value="Send Email" onClick="mailHTML()"/>
    </div>
    </form>
    </body>
    </html>

  • Locale in JSF pages with a permanent link

    Hi there,
    I am migrating an application from Struts2 to JSF. In struts2 I had mapped most of the actions so that the same action returned different locale content depending on the URL:
    http://site.com/en/content.action
    http://site.com/es/content.action
    The action returned the same JSP which showed spanish or english depending on the URL.
    Is there any approach for doing this with JSF? If not, which is the recommended approach for making the same JSF (xhtml) show different locale content depending on a request parameter (?locale=en for example)
    I have solved it using a changeLocale method in a managed bean, which works OK and changes locale, but as it uses Post, the pages are not SEO as cannot be crawled (the URL doesn't even change)
    Thanks for any ideas/approach.
    Ignacio

    You can set the locale of the JSF UIViewRoot within a PhaseListener to cause JSF to use the desired locale.
    Another, more comprehensive approach is to use a servlet filter to set the locales returned by ServletRequest. This is the source for the locale JSF uses if not overridden. If you configure the filter to cover your entire application you have the bonus of every technology being covered, not just JSF.

  • Rating widget with data table

    I am using rating widgets with php generated tables... but I
    like the spry data regions better (for sorting). is it possible to
    dynamically create rating widgets in a spry data region? I tried
    doing it by applying the information from "Using HTML Fragments In
    XML Sample " but that doesnt work. Any ideas?

    Did u check:
    http://labs.adobe.com/technologies/spry/samples/tooltip/Tootlip_with_HTML_Panel.html
    http://labs.adobe.com/technologies/spry/samples/data_region/TooltipwithData.html

  • How to: create a Login page with data tags

    hi, how could i create a jsp login page using the data tags.. and how to associate it with the other jsp pages that should be displayed in case of the correct insertion of the password .

    http://technet.oracle.com:89/ubb/Forum2/HTML/006025.html

  • Jspx page with ADF tables - complete reload

    Probably a stupid question, but how is it possible to reload and update page and all the data in adf tables via button action.
    I don't want PPR, just complete reload.

    Hello,
    Sorry for the late response.
    I dont understand why you would want the table to be refreshed since the data you commit all came from this page so it should all still be valid.
    But if you want to do this, just bind a button to the execute method of the parent table.
    This forces the query to be re-executed and all childs should be refreshed automaticly.
    In your pagedef just add the execute method as an action, the iterator should be the one of the parent application and then bind a button to this action.
    -Anton

Maybe you are looking for

  • Ideas for a new program

    Ive recently finished making a chat program using (predominantly) nio. I learnt a lot about sockets, network programming etc which was really interesting since ive never made anything along those lines before. Im now wanting to learn more about netwo

  • Running out of disk space if I don´t have too much!!!

    My hard disk is running out of space, what to do? music + iphoto + aperture + videos + docs = around 40 gb but my 250 it´s almost full. Since I got this macbook pro i get a 1tb wifii hard disk so any item i got, i put it on that hard disk. This is my

  • When using the Illustrator direct select tool in CC

    This morning I had an update and now when I use my direct select tool, all these little dots/targets show up, how do I turn that feature off? Thanks in advance

  • One NIK filter does not appear as plug-ins

    Dear All, I'm working with the NIK Color Efex Pro plug-ins that include a whole series of plug-ins, but one does not appear in Photoshop.  That is the Analog Pro 2 package.  I can get it to work, but I must open it separately because it won't appear

  • Copying of Update Rules

    Hi, I need to copy the update rules. Let me explain the requirement: The standard business content in SD provides the update rules from InfoSource 2LIS_12_VCHDR to InfoCube 0SD_C03. We have created an ODS (ZSD_O01) on the InfoSource 2LIS_12_VCHDR, wi