Jsp code doesnt run if redirected to the page

When I see page.jsp for the first time, the jsp code in it executes, but when I revisit thet page, the jsp code doesn?t.
The jsp code writes a number, and that number is shown. the first time I get a number 1, and the second I should get a number 2. but I?m getting a number 1 all the time. If I reload the page, then I get a number 2.
Is like I?m getting the local cache html version of the page.
I think it has to do with the way I get to the page. I get to the page using:
  response.sendRedirect("page.jsp");from another jsp page, or
  getAppletContext().showDocument("blablabla/page.jsp");from an applet.

The browser is probably cahcing the page and not sending the request to get an updated page.
Either set you browser settings or add this to the top of the jsp:
<% response.setHeader("Pragma", "no-cache");
   response.setHeader("Cache-Control", "no-cache");
   response.setDateHeader("Expires", 0); %>

Similar Messages

  • JSP codes for running a JAVA program

    hello...
    does anyone know the JSP codes for running a Java program from my web page?? i mean i already have my java program compiled... and i just want this java program to run in the background when I click on a button or a link...
    Any idea about this?
    plz advice..
    avi

    yes... u r somewhat right... but this runs on Jakarta Tomcat...
    i'm using the Apache Http Server together with the ServletExec AS which enable the Apache server to run JSP..
    I've created a package where i've put my classes...
    WEB-INF/classes/tbd(package name)/my classes
    and i've added.. package name.. in my java program..
    and then in jsp... i've written..
    <%@ page import="tdb.*"%>
    <jsp:useBean id="exec" class="tdb.textdb" />
    <%exec.convert_data();%>
    but when i run the page it says the package does not exist...
    can anyone tell where to place the folder WEB-INF so that it can run fine?
    thx
    avi

  • In safari, On my Ipad2,I get the error message, "too may redirects" and the page won't load. Anyone with advice? I have cleared the cache, cookies, and history and restarted.

    In safari, on my Ipad2, I get the error message " too many redirects" and the page won't load. I have cleared the cache, cookies, and history and have rebooted and I still get the same problem. Any advice?

    In safari, on my Ipad2, I get the error message " too many redirects" and the page won't load. I have cleared the cache, cookies, and history and have rebooted and I still get the same problem. Any advice?

  • TS3988 Why am i redirected to the page that says "set up icloud on this device" when i click the icloud sign in ? I am positive im signed up

    Why am i redirected to the page that says "set up icloud on this device" when i click the icloud sign in ? I am positive im signed up

    Because you are trying to go to icloud.com using Safari on your iPad.  You have to go to icloud.com from your computer browser.

  • Adobe CS5 adding extra code to an uneditable section of the page?

    I have a website that was created in Dreamweaver and has editable regions set for other people to manage the content using Contribute. The main author of the website is using Contribute CS5, and it is adding extra code to an uneditable region of the page (as defined in the template), which messes up the layout of the header and footer. Can anyone help me figure out why this is happening and how to fix it?
    I have edited the page successfully through my version of Contribute, which is 6.5--it does not add that extra junk into the code.
    The solution, might be to move my user over to 6.5, but I want to find out why it is happening, before we spend any additional money on the program.

    What's the code?

  • HT1933 When I try to report a problem, it says "too many http redirects". The page will not open, so I can't report the problem!

    How can I get to the report a problem page? The song I bought will not play! It just says "too many http redirects"

    Susiebwb wrote:
    Can any one please assist me.... I paid twice for an app by mistake.... ...
    To Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Firefox starts up perfectly fine, but when i type in any website it immediety deletes whatever address i typed in and doesnt even attempt to load the page.

    So basicly what is happening is when i type in say google.com for example. Firefox pretty much does absolutly nothing except delete google.com from the address bar, and stays on the startup page. And this happens for every website, i cannot get off the startup page because of this. And currently the only web browser that will work right now for me is IE (64-bit). Which is strange because when i try to start any other version of IE it gives me the error that tells me there is no internet connection, when there clearly is. If anyone has had this problem or knows how i can fix this i will be forever in your debt. Also, if this helps I cannot download/install chrome, vuze, torch browser, or ubuntu. Thank you all in advance.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • I can no longer get Firefox to display when I click the tab. The toolbar shows me firefox is up and running but cannot get the page to expand.

    This all happened after a windows update. It started when a pop-up I was wanting to see wouldn't come up but was showing in the toolbar below that it was up. I could click on the toolbar screen and it would shoot over to the right side out of view. I uninstalled Firefox and reinstalled and now I can't get the browser to do anything up idle in the toolbar!!

    After this, you probably will be buying some access control software...
    First, make a backup of your computer for safekeeping. To back up Firefox, see [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information].
    Next, try starting Firefox in Firefox
    [http://support.mozilla.com/kb/Safe+Mode Safe Mode]. Be careful not to "reset" anything permanently if you didn't back up.
    Does that fix it? If not, try creating a new (blank) profile: [http://support.mozilla.com/kb/Managing+profiles Managing profiles].
    To move key settings like bookmarks from your damaged profile to the new profile, see: [https://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile Recovering important data from an old profile].
    Hope this helps.

  • Why does the fire fox page change, sometimes it is just an orange fire fox button and othr times it says file, edit, view History, bookmarks, tools, help? I barely learn how to run one version of the page and then it changes

    Why does the fire fox page change, sometimes it is just an orange fire fox button on the top left that opens a panel with all the things listed in it and then it sometimes has a bar across the top that says File, Edit, View, History, bookmarks, tools, Help? I barely get used to using one type of set up and then it changes to the other without me doing anything??

    [[Menu bar is missing]] and [[Preferences are not saved]] may help to you

  • What is the difference if jsp code in head section or outside of HTML

    I am confused about what is the difference if I include jsp code inside <html><head> jsp code </head><html>, or outside of HTML tag?
    What is the difference if I put the jsp code inside head senction or in the body section?
    Thank you in advance!

    I may want to output some result from my java code to the screen, so I can see some of the variable values.
    If I use java code to get some variables before <HTML> tag, can I use <%=variable%> in the other sections like body or head to receive the results?

  • Data value changes not always reflected in .jsp code

    For example, I can change the data value of an output text field, run the project and find that the new value is not always what shows up. I get the old value instead. I have to then go into the .jsp code and modify the value= property to get the new text to display. The new value, however, was being displayed in the designer window. I can also change a form name or some other component ID and the .jsp code may still contain references to the old name as well as the new name. This causes runtime exceptions. I am new to Java programming . Anyone know what I am doing wrong? I am using the 30-day eval version of Creator. I have tried the referesh, build only , etc., but still run into problems.

    Hi,
    Could you please list some steps in case there's a bug
    and include the jsp source.
    Also, I suggest you to get the latest updates.
    Choose Tools->Update Center
    John
    JSC QA

  • Why JSP Script Always Run First...

    Hey' i don't understand about this code works, why when i run this page, it always print start in console before i click the button.
    This is my code :
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            <script language="Javascript">
                function checkButton(){       
                    <%
                    /* This declaration will print in console
                     * every time the page load.
                     * it suppose to be print after i click the buttonCheck button. */
                        System.out.println("start");
                    %>          
            </script>
        </head>
        <body>
             <form name="myForm">
                   <input type="button" value="check" onClick="checkButton()" name="buttonCheck">
             </form>
        </body>
    </html>Why my JSP Script always run before i click the button? JSP script must be run after i click my button. is there any explanation about this?
    Thanks..
    Message was edited by:
    hudoq

    the jsp scriptlet tag will be execute while compilation.
    so all the scriplet tags will be compiled and
    executed while loading. This is generally not 100% true. JSP files will be compiled only once in the fresh server start. This also explains the "long loading time" on the 1st view ;) The subsequent views just executes the already compiled JSP.

  • How to download files in jsp code {through save dialog}

    can you help me to download files in jsp code {through save dialog}
    i use the following code but it saves the jsp page instead of the downloaded file but with the name of the wanted file to be downloaded
    response.setHeader("Pragma", "public");
    response.setHeader("Cache-Control", "no-cache");
    *** download file
    if((trans !=null)&&(trans.equals("download")) )
    response.setContentType ("application/x-download");
    response.setHeader ("Content-Disposition","attachment;filename=\""+fileName+"\"");
    %>
    <script>
    window.location.href=<%=gallerypath+fileName%>';
    </script>
    <%
    trans="";
    //System.out.print("download : "+fileName );
    //***************************************

    Can you try below code, It should work...
    <%
    String myFileName = request.getParameter("fileName");
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + myFileName + "\"");
    String root = "D:/";
    InputStream in = null;
    ServletOutputStream outs = response.getOutputStream();
    try {
    in = new BufferedInputStream
    (new FileInputStream(root + myFileName));
    int ch;
    while ((ch = in.read()) != -1) {
    outs.print((char) ch);
    finally {
    if (in != null) in.close(); // very important
    outs.flush();
    outs.close();
    in.close();
    %>

  • Jsp code not being executed in browser

    Even though my applications deploy and redeploy, I can see .html files but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp, but the jsp code is either not being compiled and exceuted in a client browser or the .jsp is being compiled but not executed in the client broswer.
              

              Akilah <[email protected]> wrote:
              >Even though my applications deploy and redeploy, I can see .html files
              >but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp,
              >but the jsp code is either not being compiled and exceuted in a client
              >browser or the .jsp is being compiled but not executed in the client
              >broswer.
              How about you tell us exactly what happens, and what you expected to happen. I
              can't tell if you're getting error messages, or whether you just don't see what
              you expect on the screen.
              Note that JSP code is not ever executed in the browser. It's only ever executed
              in the appserver, and the generated output is viewed in the browser.
              

  • How to compile and deploy JSP code from Unix server command line?

    I am new to JSP technology. We are thinking to modify some of JSP code to meet our need. But I am not sure what I should do after I change JSP code. How can I compile the changed code? How to deploy? How to publish on the web?

    All files are regenerated if changed.
    That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
    Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
    Does this make any sense?
    Adam

Maybe you are looking for

  • How can I apply a backup of one device to a different device?

    Hello, This past week, my phone "fell" and the screen broke beyond all repair. And I'm not talking about a crack...I'm talking about a huge crack as well blue lines being displayed whenever I hit the home button. Other than that, the phone still work

  • Regarding output using alv grid display

    Hi experts,     i have a program FS_TAB1-A = P_T1. IF P_T1 = 0.   TEMP1 = 1.   DO TEMP1 TIMES.     FS_TAB1-A = P_T1 * DUMMY1.     APPEND FS_TAB1 TO T_TAB1.     DUMMY1 = DUMMY1  + 1.   ENDDO. now i have to diplay the p_t1*dummy1 using alv grid display

  • Glossary in .chm file

    Hi Everyone: I'm using RoboHelp HTML, ver 8.0.2.208, with other users in a version controlled environment. I have created a .chm file but the glossary and glossary tab do not appear in the file.  I do have the glossary populated with terms and info b

  • I lost my admin user

    Note: this is not a replacement for I lost my admin user, which probably ought to be renamed "I lost my admin user (OS X 10.4 and earlier)", but that Tip will not work with Leopard. I lost my admin user (OS X 10.5) If you are unfortunate enough to de

  • Color User-Defined Variables

    Yesterday I started using user-defined variables in one of my projects and whenever I inserted a variable, it was green, which was great because I could easily identify them as variables. Today I opened my project, and noticed that the variables are