Error in this code?

hi friends,
when I run this code it is giving error as
Cause: FDPSTP failed due to ORA-01427: single-row subquery returns more than one row
ORA-06512: at "APPS.UPD_VAC", line 18
ORA-06512: at line 1
can some one suggest a solution pls
the table vac_table has a single column... and it has only 1 record right now
CREATE OR REPLACE package body APPS.upd_vac is
procedure upd_prc(p_err_buf out VARCHAR2
,p_ret_code out NUMBER)
is
l_attr varchar2(100);
l_attr1 varchar2(100);
l_attr2 varchar2(100);
l_attr3 varchar2(100);
l_attr4 varchar2(100);
begin
SELECT MAX(ATTRIBUTE18) INTO L_ATTR FROM PER_VACANCIES;
select (regexp_substr (l_attr, '.*C')) into l_attr1 from dual;
select regexp_replace(l_attr,'^.*C(.+)$','\1') into l_attr2 from dual;
select to_number(l_attr2)+1 into l_attr3 from dual;
select l_attr1||l_attr3 into l_attr4 from dual;
insert into vac_table
(select l_attr4 from dual);
UPDATE PER_VACANCIES SET ATTRIBUTE18 =(select attribute from kdd_vacancy)
where vacancy_id =(select max(vacancy_id) from per_vacancies);
commit;
end;
end;

CREATE OR replace PACKAGE BODY apps.upd_vac
IS
  PROCEDURE Upd_prc(p_err_buf  OUT VARCHAR2,
                    p_ret_code OUT NUMBER)
  IS
    l_attr  VARCHAR2(100);
    l_attr1 VARCHAR2(100);
    l_attr2 VARCHAR2(100);
    l_attr3 VARCHAR2(100);
    l_attr4 VARCHAR2(100);
  BEGIN
    SELECT MAX(attribute18)
    INTO   l_attr
    FROM   per_vacancies;
    SELECT ( Regexp_substr (l_attr, '.*C') )
    INTO   l_attr1
    FROM   dual;
    SELECT Regexp_replace(l_attr, '^.*C(.+)$', '\1')
    INTO   l_attr2
    FROM   dual;
    SELECT To_number(l_attr2) + 1
    INTO   l_attr3
    FROM   dual;
    SELECT l_attr1
           ||l_attr3
    INTO   l_attr4
    FROM   dual;
    INSERT INTO vac_table
    (SELECT l_attr4
     FROM   dual);
    UPDATE per_vacancies
    SET    attribute18 = (SELECT attribute FROM   kdd_vacancy)
    WHERE  vacancy_id = (SELECT MAX(vacancy_id)
                         FROM   per_vacancies);
    COMMIT;
  END;
END; 
(SELECT attribute FROM kdd_vacancy)must return only a single row
ATTRIBUTE18 is a scalar & can only accept one value; which is correct value FROM KDD_VACANCY?

Similar Messages

  • RUN TIME ERROR IN THIS CODE

    HELLO EVERY ONE ...
    I AM GETTING run time error in this code.....can u send me the corrected code....
    START-OF-SELECTION.
    SELECT T1~MATNR
           T1~MEINS
           T1~ERSDA
           T1~ERNAM
           T1~SPART
           T2~MAKTX
           T3~LVORM
           T3~EKGRP
           T3~WERKS
           T4~LABST
           T4~SPEME
           T4~LGORT
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM MARA AS T1
           INNER JOIN MAKT AS T2
           ON T1MATNR = T2MATNR
           INNER JOIN MARC AS T3
           ON T2MATNR = T3NFMAT
           INNER JOIN MARD AS T4
           ON T3MATNR = T4MATNR
           WHERE T1~MATNR IN SMATNR.
    Thanx & Regards,
    PHANINDER

    ok i am sending u the full code.....
    REPORT  Z_SB_RP_MATERIAL.
    TABLES: MARA,
            MARD,
            MAKT,
            MARC,
            EINA,
            EINE.
    DATA: BEGIN OF ITAB OCCURS 15,
          MATNR LIKE MARA-MATNR,
          MEINS LIKE MARA-MEINS,
          ERSDA LIKE MARA-ERSDA,
          ERNAM LIKE MARA-ERNAM,
          SPART LIKE MARA-SPART,
          MAKTX LIKE MAKT-MAKTX,
          LVORM LIKE MARC-LVORM,
          EKGRP LIKE MARC-EKGRP,
          WERKS LIKE MARC-WERKS,
          LABST LIKE MARD-LABST,
          SPEME LIKE MARD-SPEME,
          LGORT LIKE MARD-SPEME,
          END OF ITAB.
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-T01.
    SELECT-OPTIONS: SMATNR FOR MARA-MATNR,
                    SERSDA FOR MARA-ERSDA,
                    SWERKS FOR MARC-WERKS,
                    SLGORT FOR MARD-LGORT.
    SELECTION-SCREEN END OF BLOCK BLK.
    TOP-OF-PAGE.
    WRITE:/ SY-VLINE,
          02 'S.NO',
          06 SY-VLINE,
          08 'MATNR',
          20 SY-VLINE,
          22 'MEINS',
          32 SY-VLINE,
          34 'ERSDA',
          44 SY-VLINE,
          46 'ERNAM',
          56 SY-VLINE,
          58 'SPART',
          68 SY-VLINE,
          70 'MAKTX',
          80 SY-VLINE,
          82 'LVORM',
          92 SY-VLINE,
          94 'EKGRP',
         104 SY-VLINE,
         106 'WERKS',
         116 SY-VLINE,
         118 'LABST',
         128 SY-VLINE,
         130 'SPEME',
         140 SY-VLINE,
         142 'LGORT',
         152 SY-VLINE.
    START-OF-SELECTION.
    SELECT T1~MATNR
           T1~MEINS
           T1~ERSDA
           T1~ERNAM
           T1~SPART
           T2~MAKTX
           T3~LVORM
           T3~EKGRP
           T3~WERKS
           T4~LABST
           T4~SPEME
           T4~LGORT
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM MARA AS T1
           INNER JOIN MAKT AS T2
           ON T1MATNR = T2MATNR
           INNER JOIN MARC AS T3
           ON T2MATNR = T3NFMAT
           INNER JOIN MARD AS T4
           ON T3MATNR = T4MATNR
           WHERE T1~MATNR IN SMATNR.
    END-OF-SELECTION.
    DATA: COUNT(4) TYPE N.
    LOOP AT ITAB.
    COUNT = COUNT + 1.
      WRITE:/ SY-VLINE,
          02 COUNT,
          06 SY-VLINE,
          08 ITAB-MATNR,
          20 SY-VLINE,
          22 ITAB-MEINS,
          32 SY-VLINE,
          34 ITAB-ERSDA,
          44 SY-VLINE,
          46 ITAB-ERNAM,
          56 SY-VLINE,
          58 ITAB-SPART,
          68 SY-VLINE,
          70 ITAB-MAKTX,
          80 SY-VLINE,
          82 ITAB-LVORM,
          92 SY-VLINE,
          94 ITAB-EKGRP,
         104 SY-VLINE,
         106 ITAB-WERKS,
         116 SY-VLINE,
         118 ITAB-LABST,
         128 SY-VLINE,
         130 ITAB-SPEME,
         140 SY-VLINE,
         142 ITAB-LGORT,
         152 SY-VLINE.
    ENDLOOP.
    THANX & REGARDS,
    PHANINDER

  • Is there a error with this code

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class ClickMe extends Applet implements MouseListener {
    private Spot spot = null;
    private static final int RADIUS = 7;
    public void init() {
    addMouseListener(this);
    public void paint(Graphics g) {
    //draw a black border and a white background
    g.setColor(Color.white);
    g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
    g.setColor(Color.black);
    g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
    //draw the spot
    g.setColor(Color.red);
    if (spot != null) {
    g.fillOval(spot.x - RADIUS, spot.y - RADIUS, RADIUS * 2, RADIUS * 2);
    public void mousePressed(MouseEvent event) {
    if (spot == null) {
    spot = new Spot(RADIUS);
    spot.x = event.getX();
    spot.y = event.getY();
    repaint();
    public void mouseClicked(MouseEvent event) {}
    public void mouseReleased(MouseEvent event) {}
    public void mouseEntered(MouseEvent event) {}
    public void mouseExited(MouseEvent event) {}
    When I compile the the code I get a "cannot resolve symbol"
    private Spot spot = null;
    spot = new Spot(RADIUS);
    I don't know if these are errors in the code

    'cannot resolve symbol' errors usually mean a problem with the declarations and initialisations at the start of your class. This is specifically to do with your line private Spot spot = null;
    i haven`t much time to look at your code, but i would suggest getting rid of the null initialisation here, and do you ever actually change this value? after a quick look it seems that you only query it to see if the variable spot is null. if you never affect this value, then it will always be null and only one if statement will ever be executed.
    but as i said i haven`t any time, so could be off here
    boutye - boss is coming bak argh!

  • Error in this code - javafx

    Sorry for the question but I'm a newbie
    I have this code:
    http://weblogs.java.net/blog/brunogh/archive/2007/09/my_first_fx_blu_1.html
    Button {
                                 text: "Inquiry"
                                 enabled : bind model.inquiryBtnEnabled
                                 action: operation() {
                                    DeviceDiscoverer.getInstance().startInquiry(DiscoveryAgent.GIAC, model.inquiryListener);
                                    model.foundDevices = null;
                                    model.inquiryBtnEnabled = false;
                                    model.cancelBtnEnabled = true;
                                 }what is the error?
    Thanks.
    And sorry for my english, too.

    Hi Gigi_One,
    this code was posted in 2007.. If you're using the Preview version, you must switch "operation" to "function"...
    Are there an error message?
    Bruno Grossi

  • ABAP Syntax error in this code - Could anyone help?

    Hi,
    I have this code which runs fine in our non-unicode SAP system.
    REPORT  ECC5_OFFSETS.
    DATA: W_KONV TYPE KONV.
    DATA: TKOMK LIKE STANDARD TABLE OF KOMK
                     WITH KEY KEY_UC
                     INITIAL SIZE 2
                     WITH HEADER LINE.
    DATA: TKOMK2 type STANDARD TABLE OF KOMK
                     WITH KEY KEY_UC
                     INITIAL SIZE 2.
    * Get some test data
    SELECT SINGLE * INTO W_KONV FROM  KONV
           WHERE  KNUMV  = '0000000061'.
    MOVE-CORRESPONDING W_KONV TO TKOMK.
    APPEND TKOMK.
    tkomk2[] = TKOMK[].
    * Original non-Unicode compliant code
    DATA: LENGTH_KEY_TKOMK(3) TYPE P.
    FIELD-SYMBOLS: <TKOMK_KEY> like TKOMK2.
    DESCRIBE DISTANCE BETWEEN TKOMK-MANDT AND TKOMK-SUPOS
              INTO LENGTH_KEY_TKOMK
    * ( Original Unicode syntax fix! )
              IN BYTE MODE.
    * Copy all the fields between these two into TKOMK_KEY field-symbol.
    * ( In Unicode this assignment fails, causing short dump at read )
    ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>.
    * Read the current record.
    READ TABLE TKOMK2 WITH KEY <TKOMK_KEY>.
    But I get the following error message in our UNICODE complaint SAP system:
    <b>"<TKOMK_KEY>" cannot be a table, a reference, a string, or contain any of these objects.</b>     
    Does anyone know how I could get around this/suggest a solution?
    Thanks in advance!

    Hi,
    Sorry if I'm being unclear.
    My requirements are twofold:
    1)the line of code:
    ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>
    does not assign anything to the fields symbol <TKOMK_KEY>
    2)The read statement does not like the fields symbol <TKOMK_KEY> being used as a key.
    Both these bits of code worked in our 4.6b system but now in the ECC5 environemtn I get syntax errors.
    Let me know if you need anything else!

  • See my error against this code jasperPrint = JasperFillManager.fillReport(s

    sir i use this code for without database report
    jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
    and comple then output window give me this error
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportsrcwithoutdatasourceireportPage1.java:390: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
    jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
    1 error
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:233: The following error occurred while executing this line:
    C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:122: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 13 seconds)
    see all error and
    plese give me idea
    thank's
    aamir

    See your other thread on the same topic
    Re: jsp give me this error javax.servlet.ServletException: oracle.jdbc.driv

  • Error compiling this code

    Could you tell me what i'm doing wrong with this code? I posted earlier for inputting char into a variable, but the post just got too long.
    I've tried below with code, but I can't get it right. Can you help me..?
    import java.io.*;
    public class Goals {
    public static void main (String args[]) {
    System.out.println("Enter time and tide:");
    InputStreamReader reader = new InputStreamReader (System.in);
    char ch = reader.read(char); // trying to read character from keyboard
    System.out.println("the character" +ch);
    This is my error here:
    Goals.java:13: '.class' expec
    char ch = reader.read(char);
    ^
    Goals.java:13: ')' expected
    char ch = reader.read(char);
    ^
    thank you...
    yash

    The read method that you want to use does not accept any argument, so the syntax you want is char ch = reader.read();
    The first error is caused because the compiler is not expecting to see the reserved word "char" at that point. It knows that the only way the code would be valid is that char was followed by .class, so it suggests it. The second error seems to be a ripple effect of the first one and gets fixed when you fix the first one.
    Once you fix that error you get another, warning you about loss of precision. This is because the read() method returns an int and you are trying to assign an int in a char, while it's well known that there are plenty of integer values that don't fit in a char. Why does Reader.read() return an int instead of char? Because it needs a way to signal the end of the stream. In a normal case the read method returns the character that was read, but -1 if the end of the stream has been reached.
    One way to fix this would be casting the int value to char, which erroneously interpretes the end of the stream as a char too:
    char ch = (char) reader.read();

  • What is the error in this code

    hi everone
    I write this code in push button
         declare
              x varchar2(222);
         begin
              x:=get_application_property(:system.mode);
              message(x);
              end;
    to know the system mode
    but the resullt was exeception ora-06502

    simple write
    x := :system.mode;
    or
    message(:system.mode);
    message(:system.mode);Best way to resolve the issue is always check Forms online help first

  • HELP! Run-time Error with this code.

    I'm having problem with the code below. But if I were to remove the writer class and instances of it (writeman), then there are no problems. Can some1 pls tell me why the writer class is giving problems. Btw, no compilation errors, only errors at run-time..........
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.MouseListener;
    import java.awt.event.*;
    public class HelloWorld extends Applet
    public static String MyString = new String("Hello");
    Graphics f;
    public void init()
    Changer Changer1 = new Changer();
    writer writeman = new writer();
    setBackground(Color.red);
    setForeground(Color.green);
    addMouseListener(Changer1);
    writeman.paintit(f);
    public void paint(Graphics g)
    g.drawString(MyString,10 ,10);
    public class Changer implements MouseListener
    public void mouseEntered(MouseEvent e)
    setBackground(Color.blue);
    MyString = "HI";
    paint(f);
    repaint();
    public void mouseExited(MouseEvent e)
    setBackground(Color.red);
    repaint();
    public void mousePressed(MouseEvent e){};
    public void mouseReleased(MouseEvent e){};
    public void mouseClicked(MouseEvent e){};
    public class writer
    public void paintit(Graphics brush)
    brush.drawString("can u see me", 20, 20);

    I assume the exception you are getting is a NullPointerException...
    When you applet is loaded, it is initialised with a call to init... the following will then occur...
    HelloWorld.init()
    writeman.paintit(f)
    // f has not been initialised, so is null
    brush.drawString("can u see me", 20, 20)
    // brush == f == null, accessing a null object causes a NullPointerException!
    The simplest way to rectify this is to not maintain your own reference to the Graphics object. Move the writer.paintit(f) method to the HelloWorld.paint(g) method, and pass in the given Graphics object. Also, change the paint(f) call in Changer to repaint(), which will cause the paint method to be called with a valid Graphics object - which will then be passed correctly to writer.
    Hope this helps,
    -Troy

  • Where's the error in this code...

    the following snippet of code throws a SQLException with a 'Invalid Handle' message.
    What's does this 'Invalid Handle' mean? And, which line of code is causing the problem?
    try {
    //RETRIEVE CITYLIST FROM DB
    cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
    while (cityList.next()) {
    //ADD CODES AND NAMES OF CITIES TO ARRAYLISTS
    String code = cityList.getString(1);
    String name = cityList.getString(2);
    codes.add(code);
    names.add(name);
    cityList.close();
    } catch (SQLException sql) {
    System.out.println("2-checkForAvailability.jsp..err->" + sql);
    Any help will be appreciated..
    regards
    Ushanta

    Yes, you don't declare the ResultSet inside that try block, so I'll assume that it's a data member of your class. I'd suggest that you make the ResultSet a local variable in that method and not try to hang onto it. Same for the statement:
    Statement statement = null;
    ResultSet cityList = null;
    try
    statement = connection.createStatement();
    cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
    while (cityList.next())
        String code = cityList.getString(1);
        String name = cityList.getString(2);
        codes.add(code);
        names.add(name);
    } catch (SQLException sql)
        sql.printStackTrace();
        System.err.println("SQL state: " + sql.getSQLState());
         System.err.println("SQL error: " + sql.getErrorCode());
    finally
        try
            if (cityList != null)
                cityList.close();
            if (statement != null)
                statement.close();
        catch (SQLException ignoreException)

  • Getting error in this code

    Hi,
    please dont consider about the performence in this case.
    i have a delete statement DELETE FROM GSM_ITEM_INFO WHERE EXPIRE_TIME<SYSDATE-1;
    this delete statement may delete millions of records,i should not delete all the records at a time.
    i have to run a loop so that each time it deletes 10000 records for each commit. if the count of records less than 10000 records then i have to come out of the loop without deleting it.  i have written code like this. getting errors.
    CREATE OR REPLACE PROCEDURE TEST_ITEM_CLEAN (limit_in IN NUMBER DEFAULT 10000)
    IS
        type ITEM_CUR IS REF CURSOR;
        L_ITEM_CUR ITEM_CUR;
        TYPE ITEM_TYPE IS TABLE OF NUMBER
            INDEX BY PLS_INTEGER;
        L_ITEM ITEM_TYPE;
    BEGIN
    for i in 1..10
    loop
        OPEN L_ITEM_CUR FOR SELECT ITEM_ID FROM GSM_ITEM_INFO;
            FETCH L_ITEM_CUR
                BULK COLLECT INTO L_ITEM LIMIT limit_in;
            FORALL indx IN L_ITEM.FIRST .. L_ITEM.LAST
              DELETE FROM GSM_ITEM_INFO WHERE ITEM_ID=L_ITEM(indx).ITEM_ID;   
       CLOSE L_ITEM_CUR;  
    end loop;  
    END TEST_ITEM_CLEAN;
    errors:
    LINE/COL ERROR
    24/11    PL/SQL: SQL Statement ignored
    24/61    PL/SQL: ORA-22806: not an object or REF
    24/61    PLS-00487: Invalid reference to variable 'NUMBER'

    Your procedure might contain just  NOT TESTED !
    begin
      loop
        delete from gsm_item_info
         where expire_time < sysdate - 1
           and rownum <= p_limit;  /* never used rownum in update like this */
         delete from gsm_item_info
         where some_key in (select some_key
                              from gsm_item_info
                             where expire_time < sysdate - 1
                                and rownum <= p_limit
        if sql%rowcount = p_limit then
          commit;
        else
          rollback;
          exit;
        end if;
      end loop;
    end;
    Regards
    Etbin

  • Please help me with this error in this code snippet!

    Code Snippet:
    REPORT  ZMKTEST6.
    data : f1(2) type c,
           f2(2) type c,
           f3(10) type n value '12345'.
      clear: f1 with 'X',
             f2 with f1,
             f3 with '3'.
    write :/ f1 ,f2, f3.
    Process Error:
    The field "F1" must have the length 1.

    hi ,
    ther is not syntax with clear with 'X".
    but you can do one thing to get the one character.
    REPORT ZMKTEST6.
    data : f1(2) type c,
    f2(2) type c,
    f3(10) type n value '12345'.
    clear: f1 with 'X',  "Comment this
    f1 = f1+0(1).        "write this
    f2 with f1,
    f3 with '3'.
    write :/ f1 ,f2, f3.
    now f1 containd one charater instead of 2.
    now you can display as usuall

  • There and error in this code

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class ClickMe extends Applet implements MouseListener {
    private Spot spot = null;
    private static final int RADIUS = 7;
    public void init() {
         addMouseListener(this);
    public void paint(Graphics g) {
         //draw a black border and a white background
    g.setColor(Color.white);
         g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
    g.setColor(Color.black);
         g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
         //draw the spot
    g.setColor(Color.red);
         if (spot != null) {
         g.fillOval(spot.x - RADIUS, spot.y - RADIUS, RADIUS * 2, RADIUS * 2);
    public void mousePressed(MouseEvent event) {     
    if (spot == null) {
    spot = new Spot(RADIUS);
         spot.x = event.getX();
         spot.y = event.getY();
         repaint();
    public void mouseClicked(MouseEvent event) {}
    public void mouseReleased(MouseEvent event) {}
    public void mouseEntered(MouseEvent event) {}
    public void mouseExited(MouseEvent event) {}
    When I compile the the code I get a "cannot resolve symbol"
    private Spot spot = null;
    spot = new Spot(RADIUS);
    I'm new to programming and I don't know if these are errors in the code

    The compiler doesn't know what "Spot" is. It isn't in any of the packages you imported (java.awt.*, etc), so I'm assuming it's another class you wrote. At compile time, the compiler must be able to find that class, so it's looking for a file named Spot.class in your CLASSPATH. I think you just have a simple classpath problem that all beginners run into. If you don't have a Spot class, then it's a different problem. Maybe you meant to declare the "spot" variable as a different thing?

  • Minor error in this code snippet?  Can you see it?

    Following is an inner class. I think this problem is really small. Here it is:
    class TotalButtonListener implements ActionListener
    public void actionPerformed(ActionEvent e)
    totalField.setText(Integer.toString(Integer.parseInt (quartersField.getText()) * quarterValue +
    Integer.parseInt(nickelsField.getText()) * nickelValue + Integer.parseInt(dimesField.getText()) * dimeValue));
    ActionListener totalListener = new TotalButtonListener();
    totalAmountButton.addActionListener(totalListener);
    HERE IS THE ERROR:
    cannot resolve symbol
    symbol : method toString (double)
    location: class java.lang.Integer
    totalField.setText(Integer.toString(Integer.parseInt(quartersField.getText()) * quarterValue +
    ^
    1 error
    Tool completed with exit code 1

    There is no method java.lang.Integer.toString() that accepts a double as the argument.
    You either want to use java.lang.Double.toString() or cast the result of your expression into an integer.
    A hint: it's much easier to read and debug this sort of code when you use temporary variables, as in:
    public void actionPerformed( ActionEvent e ) {
       int dimes = Integer.parseInt( dimesField.getText() );
       int nickes = Integer.parseInt( nickelsField.getText() );
       int quarters Integer.parseInt( quartersField.getText() );
       double total;
       total = ( quarters * 0.25 ) + ( dimes * 0.10 )...
       totalField.setText( total );
    }And when you do it this way, Java will automatically cast the total into a String for you when setting the totalField.setText().
    Don't forget, you're gonna want to check (trap) errors when the user types in a string like "hello" into the quarters field.

  • Please Find the error in this code

    Hi ,  I am new to ajax.My problem is that i cannot insert a value in to a textfield which is fetched from a database(MySql).  I have two jsp pages.Definition1.jsp and definition.jsp. I am giving the code below.[b]But it does not work[/b]. I don't know where is the problem. I am using Mozilla Firefox..  [b]Definition1.jsp[/b]  <html>  <%@ page language="java"%>  <%@page contentType="text/html" %>   <script language="Javascript" type="text/javascript">   function createRequestObject() { var tmpXmlHttpObject;   if (window.XMLHttpRequest) {   tmpXmlHttpObject = new XMLHttpRequest();       } else if (window.ActiveXObject) {   tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP"); }  return tmpXmlHttpObject; }  //call the above function to create the XMLHttpRequest object var http = createRequestObject();  function makeGetRequest(wordId) { //make a connection to the server ... specifying that you intend to make a GET request  //to the server. Specifiy the page name and the URL parameters to send http.open('get','definition.jsp?id='+wordId);       //assign a handler for the response http.onreadystatechange = processResponse;       //actually send the request to the server http.send(null); }  function processResponse() { //check if the response has been received from the server if(http.readyState == 4){       //read and assign the response from the server           var result2 = http.responseText;  var result = http.responseXML.documentElement;                  //do additional parsing of the response, if needed            //in this case simply assign the response to the contents of the <div> on the page.  document.getElementById('description').innerHTML = result2;//[b]this works correctly[/b]           alert(result.getElementByTagName('p')[0].childNodes[0].nodeValue);//nothing happends here            document.getElementById('name').value=result.getElementsByTagName('p')[0].childNodes[0].nodeValue;           [u][b]//above code does not works and this is my problem[/b][/b[/u]] } }   </script> <body>  <form> <input type="text" id="name" size=10 value=" "></input>  </form> <h1>Have you heard these terms before?</h1>  Ceraunophobia More about Ceraunophobia<br> Astraphobia More about Astraphobia<br>   <div id="description">  </div>  </body>  </html>     [b]Definition.jsp[/b]    <%@ page language="java"%><%@ page import="java.sql.*,java.io.*,java.util.*,javax.servlet.*"%> <?xml version="1.0" encoding="UTF-8"?>  <% response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); response.setHeader("pragma","no-cache"); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con=DriverManager.getConnection("jdbc:mysql://itserver:3306/manzor?user=root&password="); Statement st= con.createStatement(); Statement st1= con.createStatement();  ResultSet rs,rs1; String id=request.getParameter("id");  rs=st.executeQuery("select * from user where USERTYPE='"+id+"'");  if(rs.next()){    %>  // p tag is here , can't display it //<p> <p> <%=rs.getString(1)%></p>  //<p>  <%  }  %>[code]  [/code]  please help
    Message was edited by:
    manu_am
    Message was edited by:
    manu_am

    I'm not an AWT expert, but here's my best guess to the problem...
    I'm not sure that the ActionListener is the correct event listener to use here.
    I don't think the straight TextArea throws action events, I could be wrong here I mainly have experience with swing.
    What event are you trying to react to here? Also is there any reason for not using Swing? Then you can use the JTextArea.
    Hope I'm of some help :)

Maybe you are looking for