How to stop 'refresh' button from 'submitting' in advance?

Hi,
I am trying to create a web page that shows a list of records to be updated individually by a click of its button.
I realised that the records are 'updated' again when the page is refreshed!
Basically the codes are like this:
html>
<title>Activate Users</title>
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<body bgcolor="#FFFFFF">
     <Form name= "activate" action="./activated.jsp" METHOD="GET">
<%try{ %>
     <%@ include file="./connect/makeCon.jsp" %>
<TABLE BORDER=1 width="75%" border="1">
<TR><TH>Userid</TH><TH>Name</TH><TH>Status</TH><TH>Activate</TH></TR>
<%
     PreparedStatement stmtt = ocon.prepareStatement("Select * from studentacct where studentacct_status=?");
stmtt.setInt(1,2);     
     ResultSet rc = stmtt.executeQuery();
%>
<%
while(rc.next()){
     String userid=rc.getString("studentacct_userid");//column names must be exactly the same as that in the database.a
String name=rc.getString("studentacct_name");
int status=rc.getInt("studentacct_status");
%>      
     <TR><TD><%out.println(""+userid);%></TD>
<TD><%out.println(""+name);%> </TD>
<TD><%out.println(""+status);%></TD>
<TD><INPUT TYPE="Submit" VALUE="Activate"></TD>
</TR>
     <%     PreparedStatement stmtt2 = ocon.prepareStatement
                              ("UPDATE studentacct set studentacct_status=? where studentacct_status=2");
stmtt2.setInt(1,1);
          ResultSet rc2 = stmtt2.executeQuery();                    
     } %>
</TABLE>
<BR>
<%@ include file="./connect/closeCon.jsp" %>
<%     }catch(Exception e){
          System.out.println(e.getMessage());
          e.printStackTrace();
%>
<BR>
<%@ include file="footer.jsp" %>
</body>
<script language="JavaScript">
<!--
window.open = SymRealWinOpen;
//-->
</script>
</html>
The connection to the database is succesful, but I am not sure if I should use Javascript or is there something wrong with my codes ?
Please help thanks!

First, tou have several items from the select statement, right? So you have several rows in the table, all with a submit button. When you click the submit button, how do you know what submit button was clicked? There is nothing in that code that would let you know what button for what row was picked. So that is one problem. Without solving that problem you can't handle anything else.
You can do one of two things:
1) Make each row, or each button table cell, a form where you have a hidden field that contains some identifying info so you know which thing you are submitting.
2) Use one select button for the whole table and have radio buttons or checkboxes to allow selection of which to submit.
Then on the server side, the page the form submits to should check that the form values were submitted and if so, do the DB updates.
Second, there is no need to be running an update statement for each item selected (in the loop of DB rows). If you do like I mentioned above, you can get rid of that part.

Similar Messages

  • How to detach refresh button from address bar in the new UI of FF29?

    IN FF28 it was possible to detach the refresh button from the address bar, but now the whole address bar is just one element. I am really used to have the button on the left side and not on the right side of the screen. I would love to have the opportunity back again to separate them!
    Best,
    Robin

    Firefox is just caught up in the industry wide disease of simplifying their user interface to satisfy the needs of mobile device users. It's probably true that they make up the vast majority of users. It is troubling that this trend ruins the experience for the few of us that still use powerful computers with huge and multiple display screens.
    As a developer of web pages, I often go through a cycle of looking at a web page I am developing, tweaking it, and refreshing the browser. No matter how many times I just proofread the content, I still find mistakes that need correction. So the view, correct, refresh cycle is so frequent that I need it to be efficient with well placed controls to accomplish the cycle.
    I don't mind making the GUI extremely simple for the majority of users, but I am upset with how often these "improvements" make it difficult for the experienced user/developer to use the tool in the way that suits them.

  • How to stop the dock from showing all hidden images when hiding then showing applications

    How to stop the dock from showing all hidden images when hiding then showing applications

    It's not really something to snap a screen shot of. I believe it would need to be a video clip. For instance, when I am working on multiple images in Photoshop, I often need many images open at the same time, but I only have one image viewable and active. The hero image is active on screen while I hide the other images in the dock by hitting the yellow - button on the images. Then I "Hide" Photoshop to do something in the Finder. When I go back to Photoshop, every image that is hidden in the dock will pop open again in the active window, not just the image I was currently working on. I want these images to stay in the dock until I need them, no matter how many times I Hide the Show Photoshop.

  • How to stop volume icon from being displayed randomly

    How to stop volume icon from being displayed randomly

    Thanks for the quick response.
    I have a number of slides which act as a training module. The quiz follows this. All the answers to the quiz are in the module slides. I'd like the user to be able to see which questions they're failing on, but not be shown the answers, as, if they are failing the quiz, the whole module needs to be reviewed and the test retaken.
    If this isn't possible, I'll probably just remove the review option, thereby meaning my retake button can stay, and the user can just go back and re-read the module slides to learn the answers.
    Thanks

  • How to stop iphone 5S from downloading all my old emails

    How to stop iphone 5S from downloading all my old emails? I keep deleting the "latest"old emails and older ones just keeps popping up!

    Well Thank you for everyone's help.  I contacted the service provider, who uses google to support their email.  If anyone else has this problem....with google supported email here is the solution.
    Go to your email account
    click settings
    click "settings" (again) under the settings button
    click "forwarding and POP/IMAP"
    under POP download click "enable POP for mail that arrives from now on"
    save changes
    Then go to your iphone
    erase your email account
    re-install your email account
    now only new emails should show up on your phone, all your past emails will be saved at the server.

  • How to stop my 4S from automatically taking hundreds of photos.

    How to stop my 4S from automatically taking hundreds of photos.  I use an otterbox and I think the buttons get pushed when I put it into the belt clip.  Can I disable the side buttons for the camera?  I currently have 1.958 photos of my belt that I am deleting one at a time.  Help on how to tag and deleted belt photos would be helpful.

    As you already know, open camera roll - edit - then select the pictures then trash.

  • How to stop Time Machine from backing up Temp Files?

    Hi folks!
    I am trying to find out how to stop Time Machine from constantly backing up 'useless' temporary files accumulated from web browsing? Although I don't change or add large files to my HD, Time Machine backs up hundreds of MBs every hour. Those file amounts make sense when I consider that I browse a lot to YouTube, SoundCloud, etc to watch videos or listen to music - I just don't want them to be backed up.
    Under Time Machine Options I already excluded the following items from backups:
    ~/Library/Caches
    /Library/Caches
    ~/Downloads
    But even though I did this weeks ago, Time Machine stills finds large files to be backed up every hour and my only guess is that I am still missing a location where either Safari or Firefox - the two web browsers I use - store temporary files.
    Can you help?
    Thanks a lot in advance!

    oas2103 wrote:
    they come from my anti-virus software
    Are you sure you need that? There are no viruses that run on OSX. None. Zip. Zero.
    If you're running Windoze on your Mac, that's the same as running it on a PC, so it needs all the same anti-everything stuff you'd use on a PC.
    There is some "malware," such as Trojans, for Macs, though. But (unlike viruses that can get onto your system without your knowledge), you must approve their installation (via your Admin password) and/or operation (via the "This application was downloaded from the internet ..." prompt).
    Appropriately enough, some of these Trojans are included in pirated versions of Apple software, such as iWork!
    For the gory details, see Thomas Reed's [Mac Virus Guide|http://www.reedcorner.net/thomas/guides/macvirus].
    Thanks a lot again!
    You're quite welcome, and thanks for posting back.

  • How to stop the Dialog from being dragged

    I was hoping that someone could tell me when calling a Dialog from Jframe, a how to stop the Dialog from being dragged
    while a dialog is showing.
    When it is visible I can still click and drag the Dialog
    I want to set it so you can not drag it until the dialog has be closed.

    If you don't have access to the parent frame, a "hack" that usually works:
    Frame frame = Frame.getFrames()[0];
    if (null != frame && frame instanceof JFrame){
    JFrame jf = (JFrame)frame;
    JDialog jd = new JDialog(jf, "title");
    ... code here ...
    As each JFrame (or Frame) is opened, its stored in the array of Frames that you can get. Same thing with Dialog.getDialogs(). Almost always, at least so far for me I've never had this problem, the [0] index is the main window opened, or the parent/top frame. I'd put the check in there to be safe and make sure its a JFrame and usually you'll only have the one JFrame.

  • How to stop the Browser from caching my web pages

    Hi There
    Can anyone tell how to stop the browser from caching my jsp pages
    I am using
    <%response.setHeader("Cache-Control","no-cache");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
    %>
    but this does not work anduser is able to go back to the previous page
    which i dont want and i want the browser to display the message the page has expired
    Help appreciated
    Thanks
    Mumtaz

    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("max-age", 0);
    response.setDateHeader("Expires", 0);
    I have cut paste the code from my jsp which is working. There is one additional line. I do not know if that is the cause but there is no harm in trying that out.
    Srinivasan Ranganathan

  • How to stop  the users from changing the Decimal in SAP

    How  to stop  the users from changing User Profile

    Hai,
    It is not possible to restrict SU3 to display, because it has only S_TCODE has the authorization object.
    If you really want to restrict users from changing their profile you have to remove the SU3 access and give SU1 or SU2 which gives access only to Personnel details and Parameters.
    Hope this helps.
    Regards,
    Yoganand.V

  • How to stop the Calendar from editing your input?

    How to stop the Calendar from editing your input?

    I am constantly finding that Calendar Version 8.0 thinks it knows what I want to type but it incorrectly takes numbers and days and times out of my input and changes my appointments. I hate this new supposedly "smart" feature. Even when I edit my event correctly a second or third time it rewrites my input incorrectly again. I have to use my iPhone to override the annoying editing on my mac. I am ready to find a new calendar program unless Apple allows users to input what they want without their information being incorrectly edited.

  • How to stop PR creation from PM work order for a particular vendor?

    Hello Experts,
    We have following scenario for breakdown maintenance activities.
    When a machine breaks down, a breakdown order is created in SAP. The external manintenance services are planned in the order. When the order is released, a single PR (with multiple item numbers corresponding to number of services) is created by SAP. The PR has a release strategy. When PR is released, PO is created followed by the SES.
    The practice followed AS -IS for breakdown outside business hours:- If the breakdown happens outside business working hours, the person releasing the PRs is not available & hence PR can not be released resulting in no PO & no subsequent SES.
    In this case, the maintenance is completed by the external agency & the work order is TECO. The next day, TECO is reveresed, new PR is created, released, converted into PO, & then SES.
    TO-BE process:- Client expects that, for certain vendors identified, PR should not get created at all from the breakdown order. (The list of  vendors will be maintained seperately). For these vendors, a framework order will be created at the start of fiscal year & SES will be created as & when required agaainst the framework order.
    My concern is :- How to stop PR creation from PM work order for a particular vendor? OR delete the created PR?
    Highly appreciate your quick response.
    Thank you.
    Amit
    Note:- My ABAP consultant has checked following BADI's, but could not find it useful.
    IWO1_ORDER_BADI
    ORDER_COSTING_CK
    DATA_EXTENSION_CK
    VALUATION_CK
    ME_REQ_OI_EXT
    IWO1_PREQ_BADI
    ME_CHECK_SOURCES
    ME_REQ_POSTED
    IWO1_ORDER_BADI

    Dear Amit
    I am giving a different dimension to your question check if it fulfills your requirement -
    As we know Vendor selection comes at a later stage only after your PR creation, approval & RFQ etc. & PR generation from maintaine. order is controllled through control key PM03.  While triggering PR from order you have to specify Material group, Purchase group and vendor. Try to control it through authorisation as all these are authorisation objects. The persons executing breakdown order shall no t be given this authoriations
    shakti

  • How to add Refresh button

    Hello...
    This is my code. How to add REFRESH button in this code
    package sample.view;
    import javax.faces.event.ActionEvent;
    public class Student {
        public Student() {
            super();
        private String name;
        private String id;
        private String course;
        public void setName(String name) {
            this.name = name;
        public String getName() {
            return name;
        public void setId(String id) {
            this.id = id;
        public String getId() {
            return id;
        public void setCourse(String course) {
            this.course = course;
        public String getCourse() {
            return course;
        public void dosubmittoActionisterner() {
            // Add event code here...
            System.out.println(getName() + " " + getId() + " " + getCourse());
        public void dorefershActionlistener(ActionEvent actionEvent) {
            // Add event code here...

    Hi,
    is this a home work you are working on? Even as a student you should be able to express questions more clearly.
    Frank

  • Why do I have 2 stop/refresh buttons?

    For some reason, I have 2 stop/refresh buttons. One on the end of (and attached to) the address bar and one immediately after it.
    I have tried
    * restoring the icons to the default set
    * removing the stop and go buttons via the customise option (this completely removed both)
    * moving them around

    Solved it.
    On 3.6 I used Stop Smart/Reload (add-on to combine the stop/reload buttons). This looked like it was disabled in 4.0, but when I removed it, I suddenly had one stop/refresh button (affixed to the address bar). Looks like something was getting confused.

  • How to disable Setting button in Tools - Options - Advanced - Network from windows registry?

    Dear support,
    Now, my office use Firefox as default browser to access WebServer. And there are some policy that users must use ProxyServer. I do not want user change proxy setting in Firefox. How to disable Setting button in Tools - Options - Advanced - Network from windows registry?
    Thank you.
    Treky

    You can not use the Windows registry to disable items in Firefox. This link shows how to lock down Firefox proxy settings, change the values to suit your needs:
    http://www.stbernard.com/ip5kb/iPrism/WhatsNew/50SupportFiles/SupportFiles/IP0460.htm
    One minor variation, in step 4 instead of adding that line to all-js, you can create a file called ''local-settings.js'' containing the line shown and save the file in the same folder as all.js

Maybe you are looking for

  • The server was unable to load the SSL provider library needed to log in

    Hello All, When I am trying to login to my default SQL 2008R2 SP2 instance in windows 2003 server via ssms, I am getting the below error A connection was successfully established with the server, but then an error occurred during the pre-login handsh

  • Trackpad left click not working

    Hi The left click on my trackpad, bluetooth or usb mouse is not working anymore. Macbook 2006 core2duo OSX 10.6.8 (snow leopard) I tried: - reset PRAM(apple+option+p+r) - without battery - boot in safe mode (shift) Without succes. Also tried to disab

  • How to include a pdf file on a DVD disc?

    I have a DVD project which contains 5 tracks, each with a story etc. All works well. 2.7 Gb I want to include a downloadable/printable "users guide" in pdf format. (1.5mb) I have tried: Graphic view, click on grey, In Inspector window select "general

  • Reiser4 is great + howto

    I decided that I needed to try Reiser4 tonight. I followed [url=]the Wiki on it[/url] and was able to get it working just fine, but thought a few things in the Wiki could be improved. First off, I used the -cko patchset to get Reiser4 support since I

  • Indesign, repeat image to create pattern

    Is there a way to tile an image in Indesign, like you can in Photoshop/patterns to Illustrator/patterns? I don't want to create an image, I want to import an image and how it repeat. Why? To keep file sizes down and to speed up work.