How to diable refresh in jsp

hi all,
i want to disable the refresh button ... i am inserting into the db in the page ... i want the insertion only once .... as i am using text datatype i cant compare by db before insertion

you could do a redirect after you execute the database logic. Then when the user refreshes the page, he only refreshes the redirect.
A safety prevention would be to store a unique number somewhere in the database that you generate in your code (current timestamp would do the trick) and then put as a hidden field in your form. When the user submits the form the first time, the number won't exist and you insert. The second time the same form is submitted due to a refresh the number will exist and you simply do no transaction.

Similar Messages

  • Prolem with refreshing my jsp page

    Refreshing the page
    I have a jsp page with few buttons(like add, delete, save), during loading time, it loads data from database and display in a table of row data,when I clicked the delete button to delete a row, it removes a row of data from my database, but it still displays that deleted row, bcoz page has not been refreshed. Now I wrote 2 java script function, one which invokes my delete function in my Action class and another I am trying to again load the page after delete, so that I can get fresh data. But its not happening, do you have any idea, where am I going wrong, or how can I refresh my jsp page after I delete a row. I am getting my data from database and after that I put in session.
    Here is my small code base
    function invokeICCanAssignmentDeleteFunction()
          func();
          initialise();
    // this method deletes my data from DB
        function func()
         alert("alert 1");
        document.forms[0].action='/eta/canAssignment.do?mode=icCanAssignmentDelete';
         alert("alert 2");
    // this method initialise my form bean taking data from db and put in session inside my action class
        function initialise()
         alert("alert 3");
        document.forms[0].action='/eta/canAssignment.do?mode=icCanAssignment';
         alert("alert 4");
        }

    The following two javascript lines will only set the action value of the form and does nothing else. No server call will be made.
    document.forms[0].action='/eta/canAssignment.do?mode=icCanAssignmentDelete';
    document.forms[0].action='/eta/canAssignment.do?mode=icCanAssignment';You need to submit the form to make a server call. For Example:
    document.forms[0].action='/eta/canAssignment.do?mode=icCanAssignmentDelete';
    document.forms[0].submit();Google Javascript tutorials for more.

  • How to refresh frame1.jsp from frame2.jsp?

    Hi,
    I have main.jsp that holds frameset that contains "frame1.jsp" and "frame3.jsp".
    on submit at "frame3.jsp" it goes to "frame2.jsp", now I want to refresh "frame1.jsp"
    p.s.
    I don't mind to refresh the "main.jsp", I guess that will refresh the frames inside him too - include "frame1.jsp".
    BUT, how can I do it?

    Hi,
    this seems to be a HTML/JavaScript problem, not JSP related.
    The file frame2.jsp could refresh frame1.jsp using "onLoad" on the <body> tag.
    You could also do this before loading frame2.jsp, while pressing the submit button. Instead of using a submit buton you could use a JavaScript function that would submit the form and reload another frame.
    Good Luck!
    PS: If this isn't enough help, plese post the contents of main.jsp (the frameset) so you can get some real code back.

  • How to stop refreshing jsp after a period of time

    Dear all,
    Anyone has idea of how to stop jsp page refreshing after I get result from Backend?
    I am using META tag to do refreshing in jsp: HTTP-EQUIV="Refresh" CONTENT="60
    After I got the result from back end, say after there's a "status" bean property changed from "processing" to
    "successful".The refreshing activity is disabled?Any good way to do that?

    Why don't you use listener to listen to changed events within your application and set you refresh status flag up when changes occur

  • HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH

    Hi,
    HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH?
    Thanks

    emekaco wrote:
    Hi,
    HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH?
    ThanksSTOP SHOUTING!
    now, while displaying the form generate some random number, or take the current time in millis or whatever. Put that number in a hidden field. Insert that unique number along with the real data into the database, but before you do check if the number already exists. If it does you can be pretty sure this is a resubmit of the same data, so don't allow it. This is one way of many to prevent resubmission of existing data.
    A good way to prevent a refresh from resubmitting altogether is to do a redirect to a result page right after you deal with the POST request. When the user presses refresh then, he/she will refresh the redirect and not the form submit.

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • How to execute again the JSP codes

    Dear Experts,
    I am having trouble to execute again the JSP codes in my abc.jsp page. The sequence of the codes are:
    [ JSP codes ]
    [ HTML codes]
    My JSP file is selecting from DB2 and display the results on the same page. The selecting is depending to the selection in the combo box and included the selection into the SQL statement.
    The problem is when I change the selection at the combo box, how can I refresh the page and fill in with the new results from database by selecting with the new keyword.

    You will have to do an onChange handler for the select box, that simply submits the form, and the action would be the current page.

  • How can i refresh the session object

    Hello..
    I am jst learning jsp... i hav a problem plz help me...
    I am using <jsp:useBean id="util" class="myUtilClass" scope="session" />
    I hav modified the object content...
    how can i refresh the object...
    ie...i want to access the modified data in the session object...

    You don't do that. It should already be reflected.
    Unless you modified another instance of it. If this is the case, then fix your code logic accordingly that it modifies the right object instance.

  • Forbid refresh in jsp

    hi
    I have one jsp with some data.when I refresh jsp with button of browser.The result is:in jsp have data twise.
    when i refresh with browser button servlet execute last action.I dont like this.
    I want to forbid refresh from browser in this jsp,but this is silly,and i dont know how this.
    Any suggestions for that how forbid refresh in jsp or some other decision

    Web apps have to be able to survive all kinds of unexpected user actions with the browser, refresh, back and forward buttons, bookmarking pages in the middle of a conversation, openning a second window on the same page and so on.
    So you need to write your JSP with fewer assumptions about the data it's invoked with.
    Beyond that we'd need more details.

  • How do you refresh a report after an update?

    Hi all,
    I have a Welcome Page that has several Portlets on it. One of the Portlets is a QBE report. From the report a user can click on a column record and be transported to a form, where the user can modify the record. Once the user is satisfied with the changes, the user hits the UPDATE button and is transported back to the Welcome Page. The only problem is that the Report has not been updated. Refresh does not work on the web toolbar and the only way I figured out on how to refresh the report is to go into the 'Customize' page and make some sort of change and hit O.K. After that, I am redirected back to the Welcome Page with the Report refreshed with current data. How can I refresh the report, without going into the 'Customize' Page? What code does the 'Customize' page do, to automatically refresh the report? I am using Portal 9.0.2.2.14.
    TIA,
    Dan

    Hi,
    This is due to webcache. You can solve this problem by calling the page url with an extra parameter. That way the page would get invalidated.
    Say the page url is
    http://domain/portal/page_pageid=33,32951&_dad=portaldad&_schema=portalschema
    then you should call the page like this
    http://domain/portal/page_pageid=33,32951&_dad=portaldad&_schema=portalschema&1=2
    This just adds a dummy parameter at the end and hence invalidates the cache.
    Thanks,
    Sharmila

  • How can i access the jsp file in a asp file

    Hi every one..
    we have two projects one is developed in ASP and one is developed in JSP both are running in two different locations.
    now i want to include a jsp file from one project to ASP file in the other project.
    please tell me how can i insert the JSP file in ASP application.
    thanx in advance.

    Wouldn't that be an ASP question for an ASP forum?

  • How can I "refresh" my iTunes Library?

    How can I "refresh" my iTunes Library? I recently moved my library to an external and made the source folder change in preferences. My library now shows all exclamations asking me to locate the files. What is the quick fix to locate or "refresh" all?

    Michael,
    Your response here seems exaclty like the answer that I need.  My logic board broke and I had to get a new one.  Sent to Apple and all is working again.  I didn't have an super recent time machine back up....my last one was 2 months old.  I was able to salvage my music from the computer before sending in for repair and when I got it back, I reloaded my music file onto my machine.  I use iTunes match so maybe that kept many of my files/playlists etc in order.  But my iTunes is asking me to download many songs that are showing in iTunes and are in a folder in iTunes.  These are songs I downloaded during that 2 month break between time machine backups.  I think a refresh will fix this issue.  But when I follow your steps above, I not certain what file to choose.  I tried to go to my itunes ---> itunes media ---> music but that doesn't work.  Do I need to choose the "iTuens Library.itl" file?  I use my playlists for my job so I don't want to just guess here and lose everything.  I did do a backup of my playlists so hopefully I'm protected if something happens but just want a bit more guidance on this.  Thank you for your help and your time and let me know if you have any questions. 
    Best,
    Kirk

  • How to print report in jsp page?

    excuse me,i am new to jsp
    may i know how to pritn report in jsp page or html?
    tq

    here is a hacked up example.. i ripped out a lot, so it may not compile, but you get the idea... the full version is really long and not much new info.. just all awt/display stuff...
    package rowe;
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.sql.*;
    import utility.*;
    import java.awt.print.*;
    public class rowePrint extends JFrame implements ActionListener, Printable{
         String printType = "";
         static JButton j = new JButton("Print");
         FontMetrics fm;
         String jID, promotion, product, jComments;
         public void getInfo(int jid) {
              ResultSet rs;
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection conn = DriverManager.getConnection("jdbc:odbc:rowe");
                   Statement stmt = conn.createStatement();
                   rs = stmt.executeQuery("select j.id as jID, j.comments, p.title as pTitle, p.product, p.packagingCartonCost, p.foldingQuarterCostPerM, p.foldingQuarterCostPerM, j.customizationOption as setupFee, p.perMcost, p.qtyCarton, d.name as dName, d.contact as dContact, d.email as dEmail, d.address as dAddress, d.city as dCity, d.state as dState, d.zip as dZip, d.phone as dPhone, d.fax as dFax, r.name as rName, j.totalQty, j.orderIn, j.estFreight, j.miscCost, j.coverSelection, j.imprintSelection from jobs j, promotions p, dealers d, reps r where j.promotion = p.id and j.dealer = d.id and j.rep = r.id and j.id = " + jid);
                   rs.next();
                   jID = rs.getString("jID");
                   jComments = rs.getString("comments");
                   promotion = rs.getString("pTitle");
                   product = rs.getString("product");
              } catch (Exception e) {
                   System.out.println("getinfo: " + e);
       public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JButton) {  
                   wookie();
         public void wookie() {
              PrinterJob printJob = PrinterJob.getPrinterJob();
              Paper paper = new Paper();
              PageFormat page = new PageFormat();
              paper.setImageableArea(0, 0, 600, 780);            
              page.setPaper(paper);
              printJob.setPrintable(this, page);
              try{
                   //printJob.pageDialog(page);
              //     if (printJob.printDialog()) {
                        printJob.print();
              } catch (Exception e) {
                   System.out.println("wookie1" + e);
         public static void main(String[] args) {
              rowePrint at = new rowePrint("Invoice");
              at.getInfo((new Integer(args[0])).intValue());
              at.drawShapes();
         //     at.wookie();
         public void drawShapes() {
              setBounds(0, 0, 670, 550);
              addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}});
              j.setBounds(10, 10, 10, 10);
              j.addActionListener(this);
              getContentPane().setLayout(null);
              getContentPane().add(l);
              getContentPane().add(j);
              show();
         public rowePrint(String s){
              printType = s;
         public void paint(Graphics g) {
              g.setFont(new Font("Serif", Font.BOLD, 18));
              g.drawString(promotion, 20, 30);
              g.setFont(new Font("SansSerif", Font.PLAIN, 4));
              g.drawString("" + new java.util.Date(), 20, 37);
              g.setFont(new Font("Serif", Font.BOLD, 21));
              g.drawString("Rowe Furniture", 440, 35);
              g.fillRect(440, 40, 145, 25);
              g.setColor(Color.white);
              fm = g.getFontMetrics(new Font("Serif", Font.BOLD, 21));
              g.drawString(printType, 512 - (fm.stringWidth(printType) / 2), 60);
        public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
            if (pi >= 1) {
                return Printable.NO_SUCH_PAGE;
              paint(g);
            return Printable.PAGE_EXISTS;
    }

  • How to diable the default option of report-based total (when applicable)

    Hi,
    Anybody know how to diable the default option of report-based total (when applicable)?
    By default this aggregation rule option is checked.
    There should be some configuration tag in instanceconfig.xml or somewhere else, such as <ReportAggregateEnabled>true</ReportAggregateEnabled>?
    Regards,
    Tina

    you can change this from admin tool,
    open admin tool,
    business model and mapping
    find your column in the model
    double click your column, click on aggregation, >> default rule >> none.
    but if you do this, you cant make any sum operation.

  • How do I refresh a chart in Pages copied from Numbers?

    How do I refresh a chart in Pages (v.5) copied from Numbers (v.3)?  After updating and saving the chart in Numbers, I get no "refresh" button in Pages when I click on the chart.  Or has this very useful feature been eliminated?

    It isn't as easy as it should be.  Here is a way to get a good copy of it:
    Print the page that has the chart but choose  "Open PDF in Preview" instead of sending it to your printer.
    In Preview, using the rectangular selection tool, select the chart and whatever other elements you might want to include (title, legend, anything else nearby).
    Copy
    New from Clipboard to create a new document from it. Or you can paste it in another app.
    This should give you an exact copy of what you had in Numbers and it will not be pixelated.

Maybe you are looking for