Newbee,Having problem with submit button

Hi All,
I am very new to servlet.I am trying to delete record from my list which i am loading and showing from same servlet.It is compiling fine but when I press delete button it is not deleting the record.I don't know what's wrong with it? After delete happes i just want to see the list.
please somebody help me.
Here is my code:
public class Delete extends HttpServlet
private static final String title = "Delete Messages";
private int load_count = 0; // to verify reloading
private Exception initial_exception = null;
private Connection cx = null;
private ResourceBundle rb = null;
private String table = null;
private List messages = null;
public void init()
try {
rb = ResourceBundle.getBundle( "Settings" );
table = rb.getString("table");
Common.load_driver( rb );
catch (Exception x) { initial_exception = x; }
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
doGet(request,response);
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
HttpSession session = request.getSession();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
if (initial_exception != null)
out.println(initial_exception);
return;
messages = (List) session.getAttribute( "messages" );
try {
if (cx == null || cx.isClosed())
     cx = Common.get_connection( rb );
if (messages == null)
     if (Common.DEBUG) System.out.println( "\n=> initial load of table" );
messages = Common.getTable( cx, table );
session.setAttribute( "messages", messages );
catch(Exception x) { out.println("FIRST" + x); return; }
out.println( "<html>"
          + "<head><title>" + title + "</title></head>"
          + "<body>"
          + Common.debug_display( request, load_count++ )
          + "<h3 align=center>"
          + title
          + "</h3>"
          + "<form action='..'>"
          + "<input type=submit value='top' />"
          + "</form>"
     String selected_index = request.getParameter("index");
     System.out.println("index=" + selected_index);
if (messages.size() == 0)
out.println( "<h4 style='color:red'>NO MESSAGES</h4>"
          +"</body></html>" );
return;
out.println( "<form>"
     + "<select name=index size=5 onchange='submit()'>\n"
     + Common.selection_list( messages, selected_index )
     + "</select>"
     + "</form>"
if (selected_index != null)
     Message m = null;
try {
m = (Message) messages.get(Integer.parseInt(selected_index));
catch(Exception x) { out.println("SECOND: " + x); return; }
out.println( "<table>\n"
+ "<tr valign=top>\n"
+ "<td align=right>Creation:</td>\n"
+ "<td>"
+ "<input type=text onfocus='blur()' size=30 value="
+ Common.sgml_quote(Message.time2str(m.getCreation()))
+ ">"
+ "</td>"
+ "</tr>"
+ "<tr valign=top>\n"
+ "<td align=right>Subject:</td>\n"
+ "<td>"
+ "<input type=text onfocus='blur()' size=50 value="
+ Common.sgml_quote(m.getSubject())
+ ">"
+ "</td>"
+ "</tr>"
+ "<tr valign=top>\n"
+ "<td align=right>Body:</td>\n"
+ "<td>"
+ "<textarea onfocus='blur()' cols=50 rows=10>"
+ m.getBody()
+ "</textarea>"
+ "</td>\n"
+ "</tr>"
+ "</table>\n"
+ "<input type=submit name='action1' value='Delete'>"
out.println( "</body></html>" );
if (request.getParameter("action1") != null)
Message m = null;
String subject = request.getParameter("subject");
String body = request.getParameter("body");
try {
String date = request.getParameter("creation");
System.out.println( "\n=> date" + m.getCreation() );
String sql_delete = "DELETE FROM" + messages + "WHERE creation = "+ Common.mysql_quote(m.getCreation());
Statement st = cx.createStatement();
st.executeUpdate( sql_delete );
messages.remove( selected_index);
session.setAttribute( "messages", messages );
catch(Exception x) { out.println("SECOND" + x); return; }
out.println( "<h4 style='color:red'>Message successfully deleted</h4>" );
subject = body = null;
out.println( "<html>"
+ "<head><title>" + title + "</title></head>"
+ "<body>"
+ Common.debug_display( request, load_count++ )
+ "<h3 align=center>"
+ title
+ "</h3>"
+ "<form action='..'>"
+ "<input type=submit value='top' />"
+ "</form>"

I don't understand very well your code because it has no organization. Try to put all your code between a tag that is the word code inside brackets, and close that tag at the end of your code.
For the code that I read, you're trying to get the parameters of a form that is in the same servlet. And the forms that you print didn't have an action. So, first of all, put an action on those forms, otherwise they will do noting, at least that you supply some javascript, which isn't the case. Later, don't think that you can call or continue the methods on a servlet just because you press a button which is printed in the same servlet.
Nevertheless, put that code into brackets and we will try to help you better.
Regards.

Similar Messages

  • Hey everyone I am haveing problems with Flash Button

    Hello everyone I am new here so I am haveing problems with
    Flash Button because of the html address it wont go to the address
    that i put into it it keep going to
    http://www.faithdesigner.net/www.faithdesigner.net/pricing.html/www.faithdesigner.net
    why does it do that? this is a link problem issue with flash
    button in macromedia dreamweaver 8?
    someone please help me?
    Jeremy

    >
    http://www.faithdesigner.net/www.faithdesigner.net/pricing.html/www.faithdesig
    > ne
    > r.net
    In the dialog box for the Flash Button, in the link box, put
    the full
    absolute path if an external page. Including the
    http:// part.
    http://www.example.com/page.html
    for pages inside your site- use the browse to file icon, and
    use a relative
    path.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • Problem with submit button of jframe

    hi all
    i am having problems with the submit button. once the submit button is clicked the values should be updated to an array of objects. it is doing this. the problem is i want the current frame to close once i click submit button. i have a GUI at the background and once i click something this frame appears asking for details for th user to input. but i want only the current form to close, not the whole progrmy code is shown below
    thanks in advance
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class TextForm extends JPanel {
    public JTextField[] fields;
    public MainInteractiveMap mainClass;
    public TextForm(MainInteractiveMap m)
    mainClass= m;
    public TextForm(String[] labels, char[] mnemonics, int[] widths, String[] tips)
    super(new BorderLayout());
    JPanel labelPanel= new JPanel(new GridLayout(labels.length,1));
    JPanel fieldPanel= new JPanel(new GridLayout(labels.length,1));
    add(labelPanel, BorderLayout.WEST);
    add(fieldPanel, BorderLayout.CENTER);
    fields= new JTextField[labels.length];
    for(int i=0; i< labels.length;i+=1)
    fields[i] = new JTextField();
    if (i<tips.length)fields.setToolTipText(tips[i]);
    if (i<widths.length)fields[i].setColumns(widths[i]);
    JLabel lab = new JLabel(labels[i], JLabel.RIGHT);
    lab.setLabelFor(fields[i]);
    if (i<mnemonics.length)lab.setDisplayedMnemonic(mnemonics[i]);
    labelPanel.add(lab);
    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p.add(fields[i]);
    fieldPanel.add(p);
    public String getText(int i){
    return (fields[i].getText());
    public void printForm()
    String[] labels = {"Location","No of Bedrooms","No of Bathrooms", "Garage","last selling price","current selling price"};
    char[] mnemonics ={'L','B','b','G','L','C'};
    int[] widths = {15,1,1,4,9,9};
    String[] desc = {"Location","No of Bedrooms","No of Bathrooms", "Garage","last selling price","current selling price"};
    final TextForm form = new TextForm(labels,mnemonics,widths,desc);
    JButton submit = new JButton("Submit");
    submit.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e){
    String location;
    final int sellingPrice;
    final int numOfRooms;
    final int marketPrice;
    final int numOfBathrooms;
    final int numOfGarages;
    location=form.getText(0);
    sellingPrice=Integer.parseInt(form.getText(1));
    numOfRooms=Integer.parseInt(form.getText(2));
    marketPrice=Integer.parseInt(form.getText(3));
    numOfBathrooms=Integer.parseInt(form.getText(4));
    numOfGarages=Integer.parseInt(form.getText(5));
    mainClass.Testing(location);
    System.out.println(numOfGarages);
    System.exit(0);
    JFrame f = new JFrame("Input details of House");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(form, BorderLayout.NORTH);
    JPanel p = new JPanel();
    p.add(submit);
    f.getContentPane().add(p, BorderLayout.SOUTH);
    f.pack();
    f.setVisible(true);
    regards

    you just need to change (at end of actionPerformed())
    System.exit(0);
    to
    [whateverFrame].dispose();
    easier to show a simple demo
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        JButton btn1 = new JButton("Open new Frame");
        final JFrame f1 = new JFrame("#1");
        f1.getContentPane().add(btn1);
        f1.pack();
        f1.setLocationRelativeTo(null);
        f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f1.setVisible(true);
        btn1.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            JButton btn2 = new JButton("Close/Return");
            final JFrame f2 = new JFrame("#2");
            f2.getContentPane().add(btn2);
            f2.pack();
            f2.setLocationRelativeTo(null);
            f2.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);//do not want to close with 'X'
            f1.setVisible(false);
            f2.setVisible(true);
            btn2.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent ae){
                f2.dispose();
                f1.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Problem with submit button - Acrobat/Reader

    I have created a simple fillable form with Adobe Acrobat XI Pro with a submit button, form posted to the web. The form/button works fine for me in Google Chrome, IE, and Safari (Windows 8, Outlook email client) but doesn't seem to work for users with only Adobe Reader (9 was tested using an older version of Windsows and Outlook). After completing the form successfully, they are returned the error message: "This operation is not permitted" when they attempt to submit their form using the submit button. I'm not sure what program is causing the problem. How do I fix this?

    You need to Reader-enable the form using Acrobat. Before Reader 11 was introduced, Reader was not able to save a fille-in form unless the document was enabled. Since the changes need to be saved in order to attach it to an email, this is necessary for previous versions. Do enable a form in Acrobat 11, select: File > Save as Other > Reader Extended PDF > Enable More Tools

  • I am having problems with my button's showing up on the internet. I am using dreamweaver!!!!!!!

    I am having problem's with my button's showing up when I published the site.
    Before I published the website you could see the button's images in the preview's, but soon as I published the website the button's where there, but the image weren't
    this is my codeing
    Please help it would be much appreciate
    </style>
    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    body,td,th {
              color: #FFF;
    #apDiv1 {
              position:absolute;
              width:526px;
              height:431px;
              z-index:1;
              left: 930px;
              top: 325px;
    </style>
    </head>
    <body>
    <div id="wrapper">
      <div id="logo"><a href="index.html"><img src="wettrades logo1 .jpg" width="922" height="200" alt="wettrades logo" /></a><a href="open trade acccount.html"><img src="openaccount.jpg" width="395" height="201" alt="open account" /></a></div>
      <div id="navigation"><img src="images /home button.jpg" width="266" height="117" alt="home button" /><img src="images /render 1 button.jpg" width="259" height="117" alt="render button" /><img src="images /adhesives &amp; waterproofing.jpg" width="277" height="117" alt="adhesives &amp; waterproofing " /><img src="images /tools button 1.jpg" width="263" height="116" alt="tool's button" /><img src="images /loaction button 1.jpg" width="255" height="116" alt="location button" /></div>I
    All The Very Best
    Entwisle1992 

    Firstly, I do not understand why you are using an absolutely positioned div for your button.
    And if you gave us an actual link to the website, we could see how the AP div actually does interact with your website.
    But I do have a hunch:
    Looks like you have positioned the button off the screen. If one has one's browser open to something like 900 pixels wide, your button will be 30 more pixels to the right of where the viewer's browser is. It will also be 325 pixels down from the top, which means it will be just below many headers.
    With AP divs, often browsers won't show you scroll bars if you have positioned something off the page.

  • Problem with Submit Button in Adobe Forms Central

    I have a PDF form that I uploaded to Adobe Forms Central.  I created the fillable fields & the submit button in Forms Central.  I have several documents like this.  All have worked in the past.  Today on my latest file, the submit button doesn't always work.  I am getting some submissions, but some people have reported to me that the submit button does not work.  I tested it myself to see.  I had to create a Digital ID for myself, which seemed to work fine.  But when I click on submit, the form says "Submission Failed.  This form can no longer be submitted. Please contact the author."  I'm the author & don't know what the problem is.  Anyone know what the problem could be?

    The form is open. I should have mentioned that I made sure to check that first.  The form was created by uploading an existing PDF file that I created from a MS Word file to Adobe FormsCentral. Once the form was completed, I had a coworker test it & it worked.  We sent the form out & I have received some back, but have also received reports of the form not working.  I downloaded the form to my computer & tested it using Adobe Acrobat 9.0 Standard.  I use a Windows environment on a Dell laptop.  The form does not work for me.

  • Problem with submit button in wweb dynpro abap

    hi all,
                we have problem in submit of our interactive form in web dynpro abap.
    my scenario.
                             on event submit we have to fetch data from database table and display the same.
    On click of the SUBMIT button for the first time it fetches data but when we change the input field and submit again it dsnt trigger the event(We need to double click only then event is triggered).
    Can anyone guide us on how to fetch the data at single click.
    Thanks and Regards
    Vinoth

    The form is open. I should have mentioned that I made sure to check that first.  The form was created by uploading an existing PDF file that I created from a MS Word file to Adobe FormsCentral. Once the form was completed, I had a coworker test it & it worked.  We sent the form out & I have received some back, but have also received reports of the form not working.  I downloaded the form to my computer & tested it using Adobe Acrobat 9.0 Standard.  I use a Windows environment on a Dell laptop.  The form does not work for me.

  • Problems with "Submit" button on simple PDF form.

    Hi there!
    I have searched, but perhaps not searching forums correctly to find my answer as this seems like it should be easy to fix (she said hopefully).
    I have created a simple, offline PDF form for an event registration.
    I have fields all done, set it up to email back a simple FDF from the client with a Combo Box "Submit" button.
    When the client fills in the fields and hits "Submit" button, she gets:
    "The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder."
    I created this in Adobe Acrobat 9.
    Client is filling in using Windows XP.
    I have extended release, no security, etc.
    Is there something simple I am missing?
    Have been able to get this to work before.
    But now, not so much!
    Any help is greatly appreciated!
    Thanks!

    That's not normal. Do you know what version of Acrobat/Reader the other person is using? Can you post the form somewhere? If not, I'd be happy to take a look at it if you are free to email it to me at: acroscript at gmail dot com

  • Having problem with back button on

    The bottom left hand button on the Zen Micro won't seem to work correctly unless it is charged into the power adapter. I've tried the clean up mode but that didn't do anything, is there anything else that I can do other than rebooting it because I would hate to have to go through the whole method of inporting my music back on there cause it takes hours. Please give me any advice you have!
    ~Michelle

    having the same problem at www.dealnews.com
    not a problem with previous 3.32 version, but now i can't get back to the previous page without pressing the back button twice quickly.
    if you press it once, it just reloads the same page.
    i've reset safari, but nothing fixes it.
    anyone else have an idea?
    thanks!

  • Problem with submit button

    I have installed Acrobat 9 professional and have created a PDF with field codes embedded.  At the top of the last page, I created a button which sends the form and answers to an email account (mailto: command is used).  The form works beautifully for me but not for anyone else.  There is no protection or other specialized settings enabled.  I can fill it in and submit the form with either Reader or Acrobat Pro.  Any suggestions or ideas to solve this little problem would be greatly appreciated.

    If they are using Reader you must either enable Reader Rights or change the submission to data only (preferred). You did not say if the form was created in Acrobat or Designer. There are significant differences and you need to indicate which you used.

  • Problems with submit button.

    All i have run a report with the following SQL which creates the report and assignes tick box to select if you want to keep the value in the row.
    select HTMLDB_ITEM.CHECKBOX(1,recert,'CHECKED') "Accept",traderid,account,alias,credit,currency,allowtrading,ignorepl,riskon,lastmod,whomod,ipaddress,recert from xtrad.xtrader_recert_accounts where recert = '0'
    When i click submit on the report all values in the database get and recert gets set to 1, even if i untick certain one.
    FOR i in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    UPDATE XTRAD.XTRADER_RECERT_ACCOUNTS SET recert = '1' WHERE recert = HTMLDB_APPLICATION.G_F01(i);
    END LOOP;

    So i have changed the line proc to say
    FOR i in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    UPDATE XTRAD.XTRADER_RECERT_ACCOUNTS SET recert = '1' WHERE ACCID = HTMLDB_APPLICATION.G_F01(i);
    END LOOP;
    When i run it i get
    0.02: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.02: Branch point: BEFORE_COMPUTATION
    0.02: Computation point: AFTER_SUBMIT
    0.02: Perform Branching for Tab Requests
    0.02: Branch point: BEFORE_VALIDATION
    0.02: Perform validations:
    0.02: Branch point: BEFORE_PROCESSING
    0.02: Processing point: AFTER_SUBMIT
    0.02: ...PLSQL (AFTER_SUBMIT) FOR i in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP UPDATE XTRAD.XTRADER_RECERT_ACCOUNTS SET recert = '1' WHERE ACCID = HTMLDB_APPLICATION.G_F01(i); END LOOP;
    0.02: Show ERROR page...
    0.02: Processing point: AFTER_ERROR_HEADER
    Error Unable to update Trader Accounts.!
    OK
    0.02: Processing point: BEFORE_ERROR_FOOTER
    ORA-01722: invalid number
    So that is the ACCID or the variable (i)

  • Problem with submit button in JEditorPane

    Hi,
    I'm trying to create a browser using JEditorPane. But I have 2 problems.
    1. Refreshing the current page in JEditorPane
    2. My HTML page doesn't submit the request at all.
    Is it a problem in JEditorPane or I should make it submit as we do for hyperlinks.
    If yes, then please send me the code to make a HTML page submit.

    The form is open. I should have mentioned that I made sure to check that first.  The form was created by uploading an existing PDF file that I created from a MS Word file to Adobe FormsCentral. Once the form was completed, I had a coworker test it & it worked.  We sent the form out & I have received some back, but have also received reports of the form not working.  I downloaded the form to my computer & tested it using Adobe Acrobat 9.0 Standard.  I use a Windows environment on a Dell laptop.  The form does not work for me.

  • Having problems with rollover buttons in canvas document.

    I have a button where on mouseover I want it to play an animation inside another instance on the timeline. So for example I have 2 blue rectangles on the stage. If I rollover one of them, the other rectangle plays an animation within it's nested timeline.

    use the stage enableMouseOver (EaselJS v0.8.0 API Documentation : Stage) and add your button's mouseover listener.

  • A problem with the buttons

    We are making a video game at school. and we are having
    problems with the buttons. We are having problems with the action
    codes. like gotoandstop. and things like that. it comes up that we
    have errors do you have any possible solutions.
    Thank you,
    Blevins EAST

    trx 450 wrote:
    > We are making a video game at school. and we are having
    problems with the
    > buttons. We are having problems with the action codes.
    like gotoandstop. and
    > things like that. it comes up that we have errors do you
    have any possible
    > solutions.
    > Thank you,
    > Blevins EAST
    Need more info or file source for us to check.
    "My car does not work, what's up with that" is way too
    general to even try to
    suggest something.
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • I am having problems with my Pantech Caper. Please Help!

    I just transferred my phone number over to a used Pantech Caper that I bought a few years ago. When I used the Caper previously I had no problem with it. And the phone i had before i transferred numbers worked just fine i was just having problems with some buttons not working. Now that i have transferred the number over to the Caper i can receive texts and picture messages but can not download the messages. I can not receive calls nor can i send texts out. after i try to send a text I receive a message saying I have insufficient fund to send message. oh extra info... i have the plan for 500 minutes and unlimited text picture messages and unlimited web. Please Help... I need my phone for work.

        Hi YukiCross,
    I am  confident your issue has been resolved since your original post! If not,let's get this figured out. Based on your description it sounds like you have Pre-Paid service with us. For Pre-Paid assistance please reach out to:888-294-6804 . I can gladly address and resolve any Post-Pay related concerns.
    Thanks for your contribution to our community forums,
    AyaniB_VZW
    Follow us on Twitter @VZWSupport

Maybe you are looking for

  • Invoking a webservice from a webclient

    I have created a webservice.It is deployed , i can call web service from console application.But i want to invoke that web service from a web client , so i have to invoke it from javascript.I seriously dnt have any idea abt it.I searched on the net b

  • Parent-Child post order exception; FK constraint violation

    I've seen the discussion and answer recently in this forum for configuring BC4J to post the parent first, then the child, to avoid the FK constraint exception?? So I have to appologise for re-asking, but I can't get the search function to find any th

  • Page Navigation Howto: Region name messed up

    I followed the http://www.oracle.com/technology/products/database/htmldb/howtos/howto_navigate_in_a_page-1.6.html 1. I am using the Sand builtin theme. I didnt find a good place to put the #PAGETOP link on my (Form and Report) region templates. It me

  • Oracle Application Server On Linux Problem

    Our client's application server has been live for 6 months now and currently there is an issue. This server is a Dell 6850 running Red Hat Linux ES 3.4 (Taroon Update 5) and kernel 2.4.21-32 with 2 CPUs and 8Gb of ram. Our J2EE web application runs i

  • Error share blueprint bpmn

    Hello, i have designed a bpmn modell in the bpa suite which contains a lot of elements not provided in JDeveloper, such as link events, transactions, pegged events .... So i take a variant of this model and transformed this completly using the soa ex