Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: Servlet cant perform sql after second button click

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Servlet cant perform sql after second button click

    Hi there, I need some guidance on my servlet.

    Does anyone expert in iterator part of built in package of java libary List?
    List dataList = new ArrayList();

    Iterator itr;
    for(itr=data.iterator();itr.hasNext();)
    Actually I m able to perform first query with data display..but when I click on other button..it cant proceed servlet and it gv me blank page.
    Servlet.java
    String sql="select * from a natural left join b" +
                       "natural left crecord natural left join dwhere jobid="+jobid+
                       "order by recordid";
     
                stmt = conn.createStatement();
                stmt.executeQuery(sql);
                rs=stmt.getResultSet();
                List dataList = new ArrayList();
     
     
                while(rs.next())
                {
     
                dataList.add(rs.getInt("xxx"));
                }

    p/s: my form sure ok just dunno why cant read my parameter


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Servlet cant perform sql after second button click

    I bet your query is wrong.

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Servlet cant perform sql after second button click

    sorry typo...impossible wrong i m able to run at netbean
    String sql="select * from a natural left join b" +
                       "natural left join c natural left join d where jobid="+jobid+
                       "order by recordid";

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Servlet cant perform sql after second button click

    Yeah now you may run it. First not even possible whatever it was typo or....
    Compile your servlet class again and put in the path....
    I think you are loosing cursor when you perform some other event. YOu know writing explicit cursor in sql?

  5. #5
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Servlet cant perform sql after second button click

    erm sorry could u guide me?i m newbie in servlet..

  6. #6
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Servlet cant perform sql after second button click

    You are using APACHE?
    If yes, again compile your servlet, copy it's .CLASS file from the folder where netbeans has created project folder and in APACHE directory place it inside classes folder.

  7. #7
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Servlet cant perform sql after second button click

    ya apache..

  8. #8
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Servlet cant perform sql after second button click

    Then do as i told you to do.

  9. #9
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Servlet cant perform sql after second button click

    sorry where is servlet.CLASS located?

  10. #10
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Servlet cant perform sql after second button click

    You must read this.

  11. #11
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Servlet cant perform sql after second button click

    Problem solved. thanks to those respondants.Erm the problem is due to join tables and parameter passing..

Similar Threads

  1. [SOLVED] Click button to open JDialog
    By susieferrari in forum Java Theory & Questions
    Replies: 6
    Last Post: March 30th, 2011, 09:24 AM
  2. Waiting for a Second JButton Click
    By Firebert in forum Java Theory & Questions
    Replies: 0
    Last Post: March 16th, 2011, 08:15 PM
  3. collecting information/moving from servlet to servlet
    By CBird in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 1st, 2011, 07:04 PM
  4. [SOLVED] my code didnt perform its function
    By jamal in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 21st, 2010, 04:17 PM
  5. close JDialog on button click
    By Christophe in forum AWT / Java Swing
    Replies: 4
    Last Post: April 4th, 2010, 11:04 PM