How to retrieve values from the struts DAO to Struts JSP

Hi friends,
I have one question. i want to display values in the struts jsp file from the struts DAO class. can anyone tell how do it.
Appreciated for your help.
Thanks
G1 :)

Hi Santosh,
Thanks for your prompt reply.
Actually, my problem is i want to display complete rows from the DAO to JSP page. I'm displaying all the rows in the DAO from DB.
But i dont know how to retrieve all these data from DAO. Can i take arraylist.??
DAO:
------------     public Customers getData(Customers customers){ // Reading data from DB
     //ArrayList list = null ;
     try
          Connection conn = getSQLConnection();
          Statement statement = conn.createStatement();
          String qry = "select * from register";
          ResultSet resultSet = null;
          PreparedStatement pstat = conn.prepareStatement(qry);
          // pstat.setString(1, customers.getFname());
          resultSet = pstat.executeQuery();
//Print the data to the console
while(resultSet.next()){
          String fnam = resultSet.getString(1);
          String lnam = resultSet.getString(2);
          String gen = resultSet.getString(3);
          String addres = resultSet.getString(4);
          String cit = resultSet.getString(5);
          String zip = resultSet.getString(6);
          String county = resultSet.getString(7);
          String emal = resultSet.getString(8);
          System.out.println("First name:"+fnam);
          System.out.println("Last name:"+lnam);
          System.out.println("Address:"+addres);
          customers.setFname(fnam);
          customers.setLname(lnam);
          customers.setGender(gen);
          customers.setAddress(addres);
          customers.setCity(cit);
          customers.setZipcode(zip);
          customers.setCountry(county);
          customers.setEmail(emal);
               statement.close();
               conn.close();
          }catch(Exception e1){
               e1.printStackTrace();
          return customers;
Bean:
I have specified in this line in Bean:
request.getSession().setAttribute("customers", customers);
But in JSP. how will i populate all these data. Pls..send some code.
I'm sorry this is just practicals. i'm not doin any real time project. that;s why i have placed all these code.
Thanks for your patience for resolving my problems.
Thanks
G1

Similar Messages

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • How to retrieve photos from the iCloud

    How to retrieve photos from the iCloud

    icloud only stores photos in backups (or in a special case, when using photo stream).  If you have turned on backup and made sure the camera roll is turned on (only photos from camera roll are backed up), then you can get photos back by performing a restore.  But note that users should always sync photos to a computer to archive them, relying on icloud is not foolproof.
    http://support.apple.com/kb/HT1766?viewlocale=en_US&locale=en_UShttp://www.ipadconverter-mac.com/restore-iphone-from-icloud/
    Go to Settings>General>Reset and tap Erase All Content and Settings.  This will erase your device.  Then you will go through the setup screens again as you did when your device was new, and when given the option, select Restore from iCloud Backup.

  • How to pass value from the Z Report to the selection screen of the std rep

    Dear Experts,
    i have developed a report and the values are maintained only in internal table based on some condition.  When I execute the report, for example MM60, there is a material number field for multiple selection.
    the report should call the standard transaction and pass the values from the internal table to the multiple selection- material number of the standard transaction.
    the standard transaction should never get executed automatically.  Only the value should get passed from internal table to the standard t code.  Please help.
    regards,
    Shankar

    Hai
    Go through the following Documents
    SUBMIT rep.
    Additions
    1. ... LINE-SIZE col
    2. ... LINE-COUNT lin
    3. ... TO SAP-SPOOL
    4. ... VIA SELECTION-SCREEN
    5. ... AND RETURN
    6. ... EXPORTING LIST TO MEMORY
    7. ... USER user VIA JOB job NUMBER n
    8. ... Various additions for parameter transfer to rep
    9. ... USING SELECTION-SETS OF PROGRAM prog
    Effect
    Calls the report rep . Leaves the active program and starts the new report rep .
    Addition 1
    ... LINE-SIZE col
    Effect
    Prints the report with the line width col .
    Addition 2
    ... LINE-COUNT lin
    Effect
    Prints the report with lin lines (per page).
    Addition 4
    ... VIA SELECTION-SCREEN
    Effect
    Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.
    Addition 5
    ... AND RETURN
    Effect
    Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .
    Addition 6
    ... EXPORTING LIST TO MEMORY
    Effect
    Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' ... of the function group "SLST" .
    Addition 7
    ... USER user VIA JOB job NUMBER n
    Effect
    Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .
    Note
    When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.
    Addition 9
    ... USING SELECTION-SETS OF PROGRAM prog
    Effect
    Uses variants of the program prog when executing the program rep .
    Note
    Important
    The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.
    Note
    When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .
    Example
    SUBMIT REPORT01
    VIA SELECTION-SCREEN
    USING SELECTION-SET 'VARIANT1'
    USING SELECTION-SETS OF PROGRAM 'REPORT00'
    AND RETURN.
    Effect
    Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .
    Note
    Runtime errors
    LOAD_PROGRAM_NOT_FOUND : The specified program was not found.
    SUBMIT_WRONG_TYPE : The specified program is not a report.
    SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.
    SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .
    SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.
    Try with this Example
    Data: listobject like abaplist occurs 1 with header line.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1 .
    IF sy-subrc <> 0.
    message ID '61' TYPE 'E' NUMBER '731'
    with 'LIST_FROM_MEMORY'.
    ENDIF.
    Thanks & regards
    Sreenivasulu P

  • How to retrieve values from Dynamic Selection screen while using LDB  - PSJ

    I am having problem in PSJ Logical database. In a custom report which is using PSJ LDB, we are using PROJ and PRPS_R tables.
    When I run program it displays one dynamic selection screen, there we are giving selection criteria for PRPS (Master data WBS element) - Created on (giving some range like 2011/01/01 to 2011/01/31).
    So I want to display all WBS element which are created during the period (2011/01/01 - 2011/01/31).
    How do I retrieve the select-option low and high value of the field Created on Of WBS element if we Select data from any table based on this condition.
               Please help me.
    Thanks.

    in fact you don't have to get the values, you only need to tell to the program to take them into account :
    GET PRPS.
      CHECK SELECT-OPTIONS.

  • How to get values from the page excpet pagecontext.getparameter

    i have a requirement wherein i am passing paramteres from the "submit" button.but the problem being that,i have multiple rows in my page.what is happening is that my "submit" button is passing the values of the previous row,instead of the current row.this is i think because "commit" gets called later and params are passed before it.
    how do i solve this problem
    or if i can get to get paramteres in a advance table layout,i l be able to achieve my requirement.beacuse in advance table layout,i am not able to do pagecontext.getparameter("---" of the item

    thanks guys,
    i did try working with row refrence but it returns a null only.
    my requirement was that i had update functionality as well as "add new rows" on the same advtbl bean.an whenevr i click on "add new row" and submit,i was always gettin the parameters for the previous row.
    now,i have got a workaround to that,by having a radio button to select rows to update and whenever i click on "add new rows" ,i disable the radio button,and get the handle based on the value from radio group.
    but still row refrence dint work for me.i will appreciate if sum1 can send me the code

  • How to retrieve value from AIAInstallProperties.xml in AIA Flow.

    After PIP Developement, Installer team will build the OUI installer for the PIP.They will build the screens for our PIP based on the requirements we give them.We give them a list of properties that we need the installer to prompt for and then the installer will store the values entered by the user in AIAInstallProperties.xml file.When the code is written, these properties are used instead of hardcoding any machine names, usernames, passwords, etc. When the services are deployed the properties are replaced with the values in AIAInstallProperties.xml.
    How to retreive those values from AIAInstallProperties.xml file to your participating applications or any adapters in your code?
    When the services are deployed how the properties are getting replaced with the values in AIAInstallProperties.xml.?
    Can anyone explain the above two flow.
    Thanks in advance.

    Hi
    Prem Edwin's posting about AIAInstallProperties.xml is correct.
    Two points, the 11gR1 is a foundation pack only release, that is why the OUI is only built to collect FP related information. In the future, when PIPs arrive, new wizard steps will involve to collect PIP specific information during installation/deployment time.
    For your example of of getting a file location during installation, it would be effectively for your self-built PIPs. That is why the 11gR1 FP OUI would not support that.
    Also, there are only finite number of tokens can be detokenized from AIAInstallProperties.xml to composite.xml, if you were introducing a random new 'file path', I don't believe it would be replaced automatically by default in R1 time.
    Thanks!

  • How to retrieve data from the HTML form in the JEditorPane?

    I could quite easily use JEditorPane to render and display a simple HTML file.
    My HTML looks like this:
    <html>
    <head>
    <title> simple form</title>
    </head>
    <body bgcolor="cccccc">
    <center><h1>SURVEY THING</h1>
    </center>
    <form id="survey">
    <p>1.Type something in.</p>
    <textarea cols=25 rows=8>
    </textarea>
    <BR>
    <p>2.Pick ONLY one.</p>
    <input type="radio" name="thing" value="0" Checked> NO choice <BR>
    <input type="radio" name="thing" value="1"> First choice <BR>
    <input type="radio" name="thing" value="2"> Second choice
    <BR>
    <p>3.Pick all you like.</p>
    <input type="checkbox" name="stuff" value="A"> A <BR>
    <input type="checkbox" name="stuff" value="B"> B <BR>
    <input type="checkbox" name="stuff" value="C"> C <BR>
    <input type="submit" value="give data">
    <input type="reset" value="do clensing">
    </form>
    </body>
    </html>
    It gets diplayed fine and I can type in text, select radio buttons (they behave mutualy-exclusive,
    as they should) and check checkboxes.
    The problem I have is with retrieving the values which were entered into the form.
    If I, after editing, try to write the html to the file using HTMLWriter,
    it records the changes I made into the textarea, however all the radio and checkbox selections are lost.
    Maybe the problem is that when I enter the values I do not use any methods like
    insertBeforeStart and so on, but I believe I shouldn't need to use them to populate a form.
    Especially I never change the structure of the HTML.
    Also, when I try to traverse the Element tree and see the input elements attributes,
    I can never see a change in the entered values. However it is probably b/c I am traversing through
    the model and the changes are in the view (just a guess.)
    Anyway, if anybody could direct me onto the right path: how to retrieve the values typed in the form,
    or if it is possible at all in the JEditorPane, I would greatly appreciate.
    thanks
    maciej
    PS. I have seen the answer to a similar question posted some time last year. However, I am trying
    to find a soultion which allows forms/surveys to be built by people who have no java and only basic
    html knwledge. And Axualize way is probably a little bit too "high-tech."

    Maybe helpful for u.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Container;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    public class TestHtmlInput extends JFrame {
         JEditorPane pane=new JEditorPane();
         public TestHtmlInput() {
              super();
              pane.setEditorKit(new HTMLEditorKit());
              pane.setText("<HTML><BODY><FORM>" +
              "<p>1.Input your name.</p>" +
              "<INPUT TYPE='text' name='firstName'>" +
              "<p>2.Input your information.</p>" +
              "<TEXTAREA rows='20' name='StationDescriptions' cols='100'>" +
              "<p>3.Pick ONLY one.</p>" +
              "<input type='radio' name='thing' value='0' Checked> NO choice <BR>" +
              "<input type='radio' name='thing' value='1'> First choice <BR>" +
              "<input type='radio' name='thing' value='2'> Second Choice <BR>" +
              "<p>4.Pick all you like.</p>" +
              "<input type='checkbox' name='stuff' value='A'> A <BR>" +
              "<input type='checkbox' name='stuff' value='B'> B <BR>" +
              "<input type='checkbox' name='stuff' value='C'> C <BR>" +
              "<p>5.Choose your nationality.</p>" +
              "<select name='natio'>" +
              "<option>12</option>" +
              "<option selected>13</option>" +
              "</select>" +
              "</FORM></BODY></HTML>");
              this.getContentPane().add(new JScrollPane(pane));
              JButton b=new JButton("print firstName text");
              b.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        System.out.println("Number of Components in JTextPane: " + pane.getComponentCount());
                        for (int i = 0; i <  pane.getComponentCount(); i++) {
                             //NOTE FOR BELOW: know its a Container since all Components inside a JTextPane are instances of the inner class
                             //ComponentView$Invalidator which is a subclass of the Container Class (ComponentView$Invalidator extends Container)
                             Container c = (Container)pane.getComponent(i);
                             //the component of this containers will be the Swing equivalents of the HTML Form fields (JButton, JTextField, etc.)
                             //Get the # of components inside the ComponentView$Invalidator (the above container)
                             Component swingComponentOfHTMLInputType = c.getComponent(0);
                             //each ComponentView$Invalidator will only have one component at array base 0
                             //DISPLAY OF WHAT JAVA CLASS TYPE THE COMPONENT IS
                             System.out.println(i + ": " + swingComponentOfHTMLInputType.getClass().getName());
                             //this will show of what type the Component is (JTextField, JRadioButton, etc.)
                             if (swingComponentOfHTMLInputType instanceof JTextField) {
                                  JTextField tf = (JTextField)swingComponentOfHTMLInputType;
                                  //downcast and we have the reference to the component now!! :)
                                  System.out.println("  Text: " + tf.getText());
                                  tf.setText("JTextField found!");
                             } else if (swingComponentOfHTMLInputType instanceof JButton) {
                             } else if (swingComponentOfHTMLInputType instanceof JComboBox) {
                                     JComboBox combo = (JComboBox)swingComponentOfHTMLInputType;
                                     System.out.println("  Selected index: " + combo.getSelectedIndex());
                                } else if (swingComponentOfHTMLInputType instanceof JRadioButton) {
                                     JRadioButton radio = (JRadioButton)swingComponentOfHTMLInputType;
                                     System.out.println("  Selected: " + new Boolean(radio.isSelected()).toString());
                             } else if (swingComponentOfHTMLInputType instanceof JCheckBox) {
                                     JCheckBox check = (JCheckBox)swingComponentOfHTMLInputType;
                                     check.setSelected(true);
                                     System.out.println("  Selected: " + new Boolean(check.isSelected()).toString());
                             } else if (swingComponentOfHTMLInputType instanceof JScrollPane) {
                                  JScrollPane pane = (JScrollPane)swingComponentOfHTMLInputType;
                                  for (int j=0; j<pane.getComponentCount(); j++) {
                                       //JTextArea area = (JTextArea)swingComponentOfHTMLInputType.getComponent(0);
                                       Container c2 = (Container)pane.getComponent(j);
                                       for (int k=0; k<c2.getComponentCount(); k++) {
                                            Component c3 = (Component)c2.getComponent(k);
                                            if (c3 instanceof JTextArea) {
                                                 JTextArea area = (JTextArea)c3;
                                                 System.out.println("  " + area.getClass().getName());
                                                 System.out.println("     Text: " + area.getText());
                                                 area.setText("JTextArea found!");
                             } else {
              this.getContentPane().add(b,BorderLayout.SOUTH);
         public static void main(String args[]) {
              TestHtmlInput app = new TestHtmlInput();
              app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              app.setSize( 400, 900 );
              app.setVisible( true );
    }

  • How to read values from the following XML?

    I have been using "extractValue" to get the values from a xmltype field and no problems until now.
    The xmltype now is like:
    <a>1</a>
    <b>2</b>
    <c>1221</c>
    <c>1412</c>
    <d>11111</d>
    <e>3333</e>
    I'm able to read values from 'a,b,d,e' but not from 'c'.
    Questions:
    1)- Is posible to read the values of field c?. How?
    2)- If is not posible to read the field values, Is posible to transfor the xmlfield to:
    Where I will be able to use xmltable columns and loop getting the values.
    <a>1</a>
    <b>2</b>
    <k>
    <c>1221</c>
    <c>1412</c>
    </k>
    <d>11111</d>
    <e>3333</e>
    Like always
    Thank you in advance for your help.
    Jose Galan

    SQL> with XML as
      2  (
      3   select xmltype(
      4  '<root>
      5    <a>1</a>
      6    <b>2</b>
      7    <c>1221</c>
      8    <c>1412</c>
      9    <d>11111</d>
    10    <e>3333</e>
    11  </root>'
    12  ) XMLDOC
    13    from dual
    14  )
    15  select a, b,c, d, e
    16    from XML,
    17         XMLTABLE
    18         (
    19            '/root'
    20            passing XMLDOC
    21            columns
    22            A number(5) path 'a',
    23            B number(5) path 'b',
    24            D number(5) path 'd',
    25            E number(5) path 'e',
    26            C_XML_FRAG xmltype path 'c'
    27         ),
    28         XMLTABLE
    29         (
    30           '/c'
    31           passing C_XML_FRAG
    32           columns
    33           C number(5) path '.'
    34         )
    35  /
             A          B          C          D          E
             1          2       1221      11111       3333
             1          2       1412      11111       3333
    SQL>

  • Error in retrieving value from the inputfield.

    Hi Experts,
    There is this behaviour I saw in WD which was understood by me.
    Let me explain it :
    I am doing a comparison scenario where I compare 2 products in a grid format.
    For this I have a table with a various types of variants.
    In this grid I have a inputfield which takes an integer input and based on which there is an effect on other variant field of that product.
    Now I am retriving the value of the input field in the modify view through
    input.getValue(); parse this string to an Integer and then pass it to the model.
    Here is the problem everything works fine when the user goes and changes the value for the firsttime but if he does the same thing without the input field loosing focus it throws a Numberformat exception this occurs because the string value retrived this time is an empty string which obviously can't be parsed.
    Can anyone explain me the why is it behaving in this way?
    Any help will be truly appriciated.
    Best Regards & Thanks in Advance
    Amit

    Hi,
    If u want to change the focus before retrieving the data from input field, try
    IWDButton b=(IWDButton)view.getElement("Button");
    b.requestFocus();
    before
    IWDInputField in1=(IWDInputField)view.getElement("InputField2");
    int a=Integer.parseInt(in1.getValue());
    Regards
    Fahad Hamsa

  • How to retrieve data from the Database after deleting rows from VO ?

    Hello,
    I am using Jdeveloper 11.1.2.1.0
    I have a master and a child .
    So according my use case when a value in the master vo changes the corresponding child has to be deleted.
    but when i change back to any other value i want to undo the delete operation and get back the values in the child.
    Is there any way to do it?
    Regards,
    Nigel.
    Edited by: Nigel Thomas on Mar 29, 2012 5:07 AM
    Edited by: Nigel Thomas on Mar 29, 2012 5:09 AM

    Hi all,
    I want to do a validation based on a SelectOneChoice List Value.
    Based on which value in the select one choice is being selected, thedata from the VO should be DELETED or NOT-DELETED.
    To do this I wrote a Managed Bean and the delete part is working fine if a particular value of the SelectOneChoice is selected.
    Since the rows are deleted from the VO, after I change the SelectOneChoice value to the previous one I cannot retrieve the rows.
    I thought of two ways:
    1. As the Deleting option in the SelectOneChoice is selected the rows should be deleted from the VO and when reverted back to not-Deleting option the Rollback of Transaction method written in the Managed Bean should take place.
    2. As the Deleting option is selected the data should be deleted from the VO and when reverted back to non-Deleting option, a query should be made from the Database.
    The first plan was dropped because it is not VO-specific. If there are more than 1 VO in the page then whatever changes are made in the page will be reverted back as soon ad Rollback of transaction is done.
    So the now i am left to go with the second plan.
    Is there any way to implement the second plan?
    If so...Will it compromise the performance of the application?
    Or else, Is there any other way to implement my Use-Case ???
    Regards,
    Nigel.

  • How to retrieve value from ComboBox inside a Jtable

    Hi everyone, I've this problem: I used the code that I founded to this link:
    [http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#combobox|http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#combobox]
    So I inserted a comboBox in my Jtable but I don't retrieve comboBox's values.
    I tried to retrieve these values in this way:
    myTable1.getModel().getValueAt(rowIndex, columnIndex).getClass();but this code produce a NullPointerException.
    thank you for helping me!!!!

    but I don't retrieve comboBox's valuesCorrect, because the combo box and its data is not part of the TableModel. The TableModel only stores the item that was selected from the combo box when the cell was edited.
    If you are getting an exception it is because you haven't set any data in your table model for the given cell.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • How to retrieve value from insert statement

    hi,
    how can i get a certain value from insert statement and store it in a variable.
    suppose i am inserting emp_no , emp_name , emp_salary to employee table
    and i want to store the emp_name in a variable for other processing,
    how can i accomplish this ? i'm guessing that i have to use trigger,
    but dont know the procedure .
    any help will be greatly appreciated
    thanks

    insert into <table> valiues (....) returning <expression> into <variable>
    You could and should have found this using the SQL Language reference manual
    or
    http://www.morganslibrary.org/reference/insert.html
    Sybrand Bakker
    Senior Oracle DBA

  • How to retrieve values from Referring Nodes

    Hi
    My sample XML nodes are, assume these to nodes are in a same XML file.
    <DestinationBandDefinitionList>
    <DestinationBandDefinition>
    <DestinationBandName>Group 1</DestinationBandName>
    <DestinationList>
    <Destination>
    <Name>India</Name>
    <DestinationIdentifierList type="prefix">
    <Value>91</Value>
    </DestinationIdentifierList>
    </Destination>
    <Destination>
    <Name>USA</Name>
    <DestinationIdentifierList type="prefix">
    <Value>1</Value>
    </DestinationIdentifierList>
    </Destination>
    </DestinationBandDefinition>
    </DestinationBandDefinitionList>
    <DestinationBandDefinitionList>
    <DestinationBandDefinition>
    <DestinationBandName>Group 2</DestinationBandName>
    <DestinationList>
    <Destination>
    <Name>UAE</Name>
    <DestinationIdentifierList type="prefix">
    <Value>971</Value>
    </DestinationIdentifierList>
    </Destination>
    <Destination>
    <Name>Russia</Name>
    <DestinationIdentifierList type="prefix">
    <Value>7</Value>
    </DestinationIdentifierList>
    </Destination>
    </DestinationBandDefinition>
    </DestinationBandDefinitionList>
    <TariffList>
    <DestinationBand>
    <DestinationBandName>Group 1</DestinationBandName>
    <RatingIntervalName>standard1</RatingIntervalName>
    <Rate taxIncluded="false" type="N">3.50</Rate>
    </RateSpecification>
    <RateSpecification>
    <RatingIntervalName>standard2</RatingIntervalName>
    <Rate taxIncluded="false" type="N">3.50</Rate>
    </RateSpecification>
    </RateSpecificationList>
    </DestinationBand>
    What is the statement to query the Taxincluded value of the Group, where USA belongs.
    My DB is Oracle 10g 2.0.1.0
    Thanks in advance
    Rizly

    SQL> with XML as
      2  (
      3    select XMLTYPE(
      4  '<Root>
      5     <DestinationBandDefinitionList>
      6             <DestinationBandDefinition>
      7                     <DestinationBandName>Group 1</DestinationBandName>
      8                     <DestinationList>
      9                             <Destination>
    10                                     <Name>India</Name>
    11                                     <DestinationIdentifierList type="prefix">
    12                                             <Value>91</Value>
    13                                     </DestinationIdentifierList>
    14                             </Destination>
    15                             <Destination>
    16                                     <Name>USA</Name>
    17                                     <DestinationIdentifierList type="prefix">
    18                                             <Value>1</Value>
    19                                     </DestinationIdentifierList>
    20                             </Destination>
    21                     </DestinationList>
    22             </DestinationBandDefinition>
    23     </DestinationBandDefinitionList>
    24     <DestinationBandDefinitionList>
    25             <DestinationBandDefinition>
    26                     <DestinationBandName>Group 2</DestinationBandName>
    27                     <DestinationList>
    28                             <Destination>
    29                                     <Name>UAE</Name>
    30                                     <DestinationIdentifierList type="prefix">
    31                                             <Value>971</Value>
    32                                     </DestinationIdentifierList>
    33                             </Destination>
    34                             <Destination>
    35                                     <Name>Russia</Name>
    36                                     <DestinationIdentifierList type="prefix">
    37                                             <Value>7</Value>
    38                                     </DestinationIdentifierList>
    39                             </Destination>
    40                     </DestinationList>
    41             </DestinationBandDefinition>
    42     </DestinationBandDefinitionList>
    43     <TariffList>
    44             <DestinationBand>
    45                     <DestinationBandName>Group 1</DestinationBandName>
    46                     <RatingIntervalName>standard1</RatingIntervalName>
    47                     <Rate taxIncluded="false" type="N">3.50</Rate>
    48                     <RateSpecificationList>
    49                             <RateSpecification>
    50                                     <RatingIntervalName>standard2</RatingIntervalName>
    51                                     <Rate taxIncluded="false" type="N">3.50</Rate>
    52                             </RateSpecification>
    53                     </RateSpecificationList>
    54             </DestinationBand>
    55     </TariffList>
    56  </Root>') XMLDOC
    57    from dual
    58  )
    59  select xmlquery
    60         (
    61           '$doc/Root/TariffList/DestinationBand[DestinationBandName/text() = $doc/Root/DestinationBandDefinitionList/De
    BandDefinition[DestinationList/Destination[Name="USA"]]/DestinationBandName/text()]/Rate/@taxIncluded'
    62           passing XMLDOC as "doc" returning content
    63         )
    64    from XML;
    false
    Elapsed: 00:00:00.09
    Execution Plan
    Plan hash value: 2594004460
    | Id  | Operation                            | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                     |                        |     1 |       |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                      |                        |     1 |     2 |            |       |
    |*  2 |   FILTER                             |                        |       |       |            |       |
    |   3 |    COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    |   4 |    NESTED LOOPS                      |                        |   667K|  2606K|   221K  (1)| 00:44:24 |
    |   5 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |*  6 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |   7 |  FAST DUAL                           |                        |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( EXISTS (SELECT 0 FROM TABLE() "KOKBF$",TABLE() "KOKBF$" WHERE
                  SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ_UPKXML2SQL(SY
                  S_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)))
       6 - filter(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ
                  _UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0))
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> set heading on
    SQL> with XML as
      2  (
      3    select XMLTYPE(
      4  '<Root>
      5     <DestinationBandDefinitionList>
      6             <DestinationBandDefinition>
      7                     <DestinationBandName>Group 1</DestinationBandName>
      8                     <DestinationList>
      9                             <Destination>
    10                                     <Name>India</Name>
    11                                     <DestinationIdentifierList type="prefix">
    12                                             <Value>91</Value>
    13                                     </DestinationIdentifierList>
    14                             </Destination>
    15                             <Destination>
    16                                     <Name>USA</Name>
    17                                     <DestinationIdentifierList type="prefix">
    18                                             <Value>1</Value>
    19                                     </DestinationIdentifierList>
    20                             </Destination>
    21                     </DestinationList>
    22             </DestinationBandDefinition>
    23     </DestinationBandDefinitionList>
    24     <DestinationBandDefinitionList>
    25             <DestinationBandDefinition>
    26                     <DestinationBandName>Group 2</DestinationBandName>
    27                     <DestinationList>
    28                             <Destination>
    29                                     <Name>UAE</Name>
    30                                     <DestinationIdentifierList type="prefix">
    31                                             <Value>971</Value>
    32                                     </DestinationIdentifierList>
    33                             </Destination>
    34                             <Destination>
    35                                     <Name>Russia</Name>
    36                                     <DestinationIdentifierList type="prefix">
    37                                             <Value>7</Value>
    38                                     </DestinationIdentifierList>
    39                             </Destination>
    40                     </DestinationList>
    41             </DestinationBandDefinition>
    42     </DestinationBandDefinitionList>
    43     <TariffList>
    44             <DestinationBand>
    45                     <DestinationBandName>Group 1</DestinationBandName>
    46                     <RatingIntervalName>standard1</RatingIntervalName>
    47                     <Rate taxIncluded="false" type="N">3.50</Rate>
    48                     <RateSpecificationList>
    49                             <RateSpecification>
    50                                     <RatingIntervalName>standard2</RatingIntervalName>
    51                                     <Rate taxIncluded="false" type="N">3.50</Rate>
    52                             </RateSpecification>
    53                     </RateSpecificationList>
    54             </DestinationBand>
    55     </TariffList>
    56  </Root>') XMLDOC
    57    from dual
    58  )
    59  select xmlquery
    60         (
    61           '$doc/Root/TariffList/DestinationBand[DestinationBandName/text() = $doc/Root/DestinationBandDefinitionList/De
    BandDefinition[DestinationList/Destination[Name="USA"]]/DestinationBandName/text()]/Rate/@taxIncluded'
    62           passing XMLDOC as "doc" returning content
    63         ) RESULT
    64    from XML;
    false
    Elapsed: 00:00:00.10
    Execution Plan
    Plan hash value: 2594004460
    | Id  | Operation                            | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                     |                        |     1 |       |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                      |                        |     1 |     2 |            |       |
    |*  2 |   FILTER                             |                        |       |       |            |       |
    |   3 |    COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    |   4 |    NESTED LOOPS                      |                        |   667K|  2606K|   221K  (1)| 00:44:24 |
    |   5 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |*  6 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |   7 |  FAST DUAL                           |                        |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( EXISTS (SELECT 0 FROM TABLE() "KOKBF$",TABLE() "KOKBF$" WHERE
                  SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ_UPKXML2SQL(SY
                  S_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)))
       6 - filter(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ
                  _UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0))
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>

  • How to retrieve datas from database to dropdown list in jsp

    hai.
    please tell me how to retrieve a perticular field list from database to a drop down list using jsp. i am new to jsp. i am doing employee management system. in that i need to edit employee's details as like.
    so that i want to display employee id's in a drop down list. i want to retrieve from database and display.
    please help me in this .
    advance thanks.

    Hello friendz,
    If tht is the i wud suggest if guyz can go wid AJAX...
    try to make use of xmlHttp Object and generate a new dependent drop down by using a property from a bean->servlet->VIEW(FORM)
    else save the form state in a session and then refersh it. once all in again.
    i had a similar problem which i solved in the following way
    Hi friend,
    I had a similar situation and i tried to solve it by using XmlHttpRequest Object(used in AJAX).
    U can checkout the below example just for further reference delete
    UserForm.jsp:
    ==========
    <head>
    <script>
    var xmlHttp
    function showState(str)
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    alert ("Browser does not support HTTP Request")
    return
    var url="getState.jsp"
    url=url+"?count="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChange
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    function stateChange()
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    document.getElementById("state").innerHTML=xmlHttp.responseText
    </head>
    <body>
    <select name='country' onchange="showState(this.value)">
    <option value='india>india</option>
    </select>
    <br>
    <div id='state'>
    <select name='state' >
    <option value='-1'>pickone</option>
    </select>
    </div>
    </body>       
    getState.jsp
    ============
    <%@page language="java" import ="java.util.Hashtable" import ="java.util.Set" %>
    <%
    String country=request.getParameter("count");
    response.setContentType("text/html");
    response.setHeader("Cache-Control","no-cache");
    try{
    Hashtable ht = (Hashtable)session.getAttribute("<ATTRIBUTE_NAME>");
    String buffer="<select name='state'><option value='-1'>Pick One</option>";
    Set s=ht.keySet();
    Object keys[]=s.toArray();
    int size=keys.length;
    for(int i=0; i < size;i++){
    buffer=buffer+"<option value='"+ht.get(keys).toString()+"'>"+ht.get(keys).toString()+"</option>";
    buffer=buffer+"</select>";
    response.getWriter().println(buffer);
    catch(Exception exp){
    response.getWriter().println(exp);
    %>

Maybe you are looking for

  • How To Call a Broadcasting Template within an ABAP program

    I was wondering if anyone knew how to call the Broadcast template via an ABAP program so it will execute?  The scenario that I have is we are doing validations via BW.  We put the data (for conversion reasons) through validation rules and then load a

  • My ipod shuffle (4th gen) don't works after hard reset with itunes

    My ipod shuffle (4th gen) don't works after hard reset with itunes, it don't reads too like USB by Windows. Before that i've seen error (-50) in iTunes, so i reset ipod. I've read all tips on this site, but nothing helps me.

  • Oracle 8i Lite login question

    I have installed Oracle 8i Lite on my notebook computer running Windows 98. When I tried to login to a SQl*Plus session (using all of the combinations of default usernames/passwords, I get the error message: "ORA-12203: TNS: Unable to connect to dest

  • How to prevent any website from bypassin firefox

    I use FF15. Whe I have any web site open, a WANTED site, ANY other UNWANTED web site can either open on top of my current site, or open in the desktop BEHIND my current site. The only way I know these sites are there is the tab in the system tray, th

  • Automatic modem installation failed error

    Hi I am pairing my BB 8900 with a laptop running 32 Bit Vista. At the end of the pairing process I get the following error message on my laptop. "Automatic modem installation failed. Please set up again" I reset the pairing but still get the same err