Disk cache javascript functions and images

Hi,
How can I force client browsers of my web application to cache the images and other javascript entities like css, functions, js files, etc.
By default it is not caching, though it should have. I have not written any code saying not to cache. Any help.
Environment : Tomcat server - java beans - jsp [struts framework]
In Netscape 7 if I say 'page view' it shows images and media files of my applications are not cached. Thats why application is really slow. If I compare this to some other web application which is fast, I see that media files, js files and images gets 'DISK CACHED'.]
Can anyone explain me what is disk cache and how to get it disk cached?
Thanks,
sunil

Thanks. I now understand whats the concept of disk cache.
But after lot of analysis also my problem still remains the same. Just that there are some patterns available.
I have some images in my own application. I also have some images which reference another site [application]. Interestingly all images which reside in my appication are not getting cached. All image which I refer into other site are getting cached. Can anyone makeout anything from this?
I looked into META tag generated for resulting htmls. But they dint have anything which says browser not to cache.
Can anyone list any java/jsp/html instructions which can tell browser not to cache stuff.
Or more importantly is there any setting or instruction or command which I can write in my java/jsp/html which can override any such setting done.
Thanks,
Sunil

Similar Messages

  • Cache javascript functions and images

    Hi,
    Web based J2EE application [STRUTS FRAMEWORK]
    None of my images, javscript and media functions/files are getting cached by browsers. I printed the HttpServletRequest headers and it shows
    request.getHeader("cache-control") = "no-cache"
    I want all my images and other stuff to get cached. I am not setting anything anywhere not to cache. I dont know how cache-control has become no-cache
    I tried many things like
    SETTING META tag "cache-control" to "Public" in all my jsps
    In all my java action classes I have putreposnse.setheader("cache-control","Public");
    But no luck. Any ideas?
    Thanks
    Sunil

    i dont think you can control that.
    If your browser is setup to reload page every visit then i guess he reloads, nothing you can do about that.

  • How to get value stored in  javascript function and display in a JSP

    i am doing a questionaire which is for user to input data in every question, After user input the data, a javascript function will be called to do some score calculation. Since each question will carry its final score after the calculation by the javascript function, so i use an array to store those scores and then display those scores in the same page.
    However, i have to make a confirmation page to display both data and calculated score in another jsp, i only know how to display the data as it is a textfield that i can get the value by "request.getParameter("textfield1"); but i dun know how to get those scores as they are stored in an array in the javascript function, what way i can do??

    thank you for all your help!
    I have chosen to set the score value to the hidden field when every time run the function
    <script language="javascript">
    function cal(index){
    var thisForm = document.MC;
    thisForm.score1.value=score[index];//set value to the hidden field     
    </script>
    <input type="hidden" name="score1" value="">
    <input type="hidden" name="score2" value="">
    <input type="hidden" name="score3" value="">
    The function will calculate only one score when every time being called. So that i can only assign one score to one hidden value at a time.
    e.g, assign score[1] to thisForm.score1.value
    assign score[2] to thisForm.score2.value
    assign score[3] to thisForm.score3.value
    how can i do this??

  • Javascript functions and Extendedscript -- newbie help

    I am new to the Photoshop scripting world and starting with a basic script to gather folder names and then remove the path. When I use the code below ESTK throws an error that labs[i].substring is not a function. That I know, it's not...but it is valid javascript. Need an explanation please.
    Thanks
    #target photoshop
    //Sizes Tab
    //Lab Drop-down menu
    var labSets = Folder('~/Desktop/Template Hub/');
    var labSets = labSets.getFiles();
    //Create Array containing Lab names from folder names
    var labs = labSets;
    for (i=0; i<labs.length; i++) {
        var v = labs[i].substring(labs[i].lastIndexOf("/")+1);

    labs[i] is a file or folder object. Strings have a substring method. You could convert the file/folder to a string but I think it's better if you use a file/folder porperty. Something like this...
    #target photoshop
    //Sizes Tab
    //Lab Drop-down menu
    var labSets = Folder('~/Desktop/Template Hub/');
    var labSets = labSets.getFiles();// this get all file and folders
    //Create Array containing Lab names from folder names
    var labs = [];
    for (i=0; i<labSets.length; i++) {
        if( labSets[i] instanceof Folder ){
            var v = decodeURI(labSets[i].name);// decodeURI deals with spaces and other such chars in the folder name
            labs.push(v);

  • Get Javascript values and use them in a servlet?

    Hey
    I have a HTML which has Javascript scripts which I have to get values from (a array to be exact) and pass them to a servlet so I can process the information in a certain way. I cant seem to find a way to do this properly as the servlet is server side and Javascript is client side. How can I implement this?
    Using a quick example example I have
    C:/index.html
    C:/js/script.js
    Index.html contains:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript" src="js/script.js">
    </script>
    </head>
    <body>
    a href="javascript:void(0);" id="add"><img src="images/menunew.png" alt="plus" border="0" />
    /a>
    </body>
    </html>
    Script.js contains:
    var Script = Class.create({
    a:4,
    b:5,
    add: function(){       
    return (this.a + this.b);
    (Ignore syntaxis errors as this is a quick example I wrote up just to see if you can give me a practical example on how to read it.)
    How can from a Java servlet access a and b from the script.js file (which contains a class named Script) and also access the function add which returns that value?
    Thank you for the help
    Edited by: 902756 on 16-dic-2011 0:18

    DrClap wrote:
    902756 wrote:
    1: Yes, it seems like the logically answer but Im not too up on AJAX and even less on mixing it up with servlets. Do you mind giving me a simple add (function) sample or something similar?You are looking at it the wrong way. What you actually want to do is to have the browser send a request (which somehow contains that Javascript data) to a URL which causes the servlet to receive the data. There's no "mixing it up" going on there. The client and the server are entirely separate.
    And since that request would be an HTTP request, it's just text. There's no concept in HTTP of transmitting objects, whether they be Javascript objects or Java objects. Anything you want to transmit has to be converted into text by the sender and converted back into objects by the receiver.
    So there's no such thing as "a simple add function". You're going to have to stop thinking in that way and start thinking of client-server systems in the way they actually are.The thing is I want to start simple to grab a simple concept....
    Im trying a AJAX route and I have the following:
    /index.html
    /js/Adding.js
    Index contains:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
         <title></title>
         <script type="text/javascript" src="js/Adding.js"></script>
    </head>
    <body>
    <select name="num1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    <select name="num2">
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    <form method="get" name="adding">
    Do
    <span id="res"></span>
    </form>
    </body>
    </html>
    Adding.js contains
    var Adding = Class.create({
    x: null,
    y: null,
    add: function()
         var xmlHttp = new XMLHttpRequest();
         var value1 = document.getElementById("num1").value;
    var value2 = document.getElementById("num2").value;
         xmlHttp.open("GET", "index.html", false);
         xmlHttp.send(value1 + value2);
         var result = document.getElementById("res");
         result.innerHTML = xmlHttp.responseText;
    This shows 2 comboboxes full of numbers and link saying "Do" which calls the javascript function and adds the two numbers in the comboboxs and shows them on the screen without refreshing the page. This does not work and I would like this to work before I continue onto the bigger picture.

  • Call Javascript function with getURL

    I can either open a new window using the
    getURL(javascript:function()) or I can open a new page and pass a
    variable using getURL("yourpage.aspx", "Get") but I really need to
    open the pop up with the javascript:function AND bring the
    information from the variable into an HTML form field within the
    pop up.
    Any help would be greatly appreciated.

    i have this in my flash file:
    w = image[p];
    getURL("javascript:show(" + w + ")");
    (w ends up being /images/myimage01.jpg, and so on...)
    the javascript function is this:
    function show(url) {
    var a = document.getElementById('dummyanchor');
    a.setAttribute('href',url);
    myLightbox.start(a);
    im acutally getting an error saying invalid flag after
    regular expression now.
    any other thoughts?
    thanks for the response.

  • Binding to a javascript function is not working

    I am trying to use the following code to bind to a javascript
    function and it's not working. I finally had to use jQuery to bind
    the event handler, but I would like to see the CF generated stuff
    work. Am I missing something here?
    This jquery code is the workaround:
    $('.match').change(function(){
    updateSA(this);

    Binding is not restricted to flash forms. I can bind directly
    to a cfc without problems, but in this case I need to send more
    info to the cfc than a single field would provide. You're supposed
    to be able to bind to a javascript function using the syntax above,
    but it's not working properly.
    More details here:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=ajaxdata_03.html#1128486

  • A swf in an iFrame calling javascript function on Parent page

    I have a .swf that has to load in a iFrame and needs to call a browser cookie javascript function that lives on the parent page that loads the iFrame.
    I'm using this:
    ExternalInterface.call("javascriptFunction");
    but of course this call is not making it to the Parent page javascript function.  Is this possible to do?
    Thanks!

    The parent page has the javascript function, and has a iFrame that loads the swf.  The swf needs to call the javascript function that lives in the parent page.
    Thanks!

  • Synchronizing sound and image for splash screen.

    Hello all,
    I have a peculiar request. ...
    I have a sound file (about 137KB) and an animated gif (about 134KB).
    I would like to use this as my splash window before my app starts up.
    I know how to load these 2 to a screen but my problem is how do I synchronize the sound to go along with the image when it starts up? (Its a gunshot sound, whcih is looped with the animated image showing the bullet holes ;-)
    I've been investigating using the Timer class but no success to date.
    Currently, the sound file loads up, starts and then a few seconds later the image..
    So.... How do I:
    1. Load the sound first.
    2. Load the image.
    3. Start both of them synchronized.

    This is actually pretty involved...
    Are you using java.applet.AudioClip to play the sound? Are you loading the animated gif as a JLabel or something using ImageIcon?
    If you are using AudioClip for the audio, I suggest that you cache the sound and image before playing the sound... otherwise you'll probably hear pops or the sound will pause. To cache the sound, do this:
    AudioClip clip = Applet.newAudioClip("somefile");
    Unfortunately, java really sucks at handling animated gifs. On slower computers, I've seen it take about 15-20 seconds to load an animated gif that's around 90k in size... totally unacceptable! If you have a gif that just plays a once (or a few times) and then stops, you'll have to flush the graphic to restart the image. This will reload the file and cause the long delay every time you need to replay the gif.
    It seems like the best thing to do is to break up the animated gif into frames (either put each frame in its own file, or place each frame into one large image file and use clip rectangles to retrieve frames) and handle the animation yourself with your own thread. Alternatively, you can use the GifDecoder utility available at http://www.fmsware.com/stuff/gif.html, but be careful when using GifDecoder, it eats up a lot of memory for larger Gif files. When you handle the animation yourself, things should work properly. Again, make sure to cache the images by doing something like:
    ImageIcon ii = new ImageIcon("somefile");
    Once everything is preloaded, things should be pretty much synchronized if you play the sound and then show the image.
    To have more control, you may have to use an object with synchronized methods... like if you want a sound to play on the 3rd and 10th frame of animation. Another option is to use Quicktime for Java.
    If you need more info, let me know!

  • Setting the value of a java variable in javascript function

    How can i set the value of a java variable in a javascript function?
    <%
    String fName = "";
    %>
    now i want to define a javascript function which can set the value of fName to the value it has been passed.
    <script language="javascript">
    function setJValue(val)
    </script>
    Thanks

    The only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.

  • Using Javascript function with Scriptlets

    if i have a javascript function and i want to use jsp scriptlet in it ...izzit possbile ??
    pls help :)

    I think you can use JSP <%= %> tags directly inside
    javascript tags.
    for eg:
    <script langauge="javascript">
    function XYZ() {
    if ( variable1 == <%=variable2%> ) {
    </script>

  • JavaScript functions across the forms?

    Hello,
    We are developing set of forms using LiveCycle Designer. The forms are complex and need some involved JavaScripts. I found great feature where we can insert a script object to hold common JavaScript functions and use those anywhere in the form. However, as I need to create some 35 such forms, I was wondering if there is any way of creating a library of JavaScript functions that I can use for all the forms. I.e. I do not want to create Javascript Object per form but want to find out if I can have one JavaScript object that I can reference from all the forms?
    Thanks in advance!

    Hi Niall,
    Feeling especially lazy today, I thought I'd try asking rather than testing this to find the answer. How does updating scripts in the library work? If I have multiple forms that use a script from the Fragment Library, when I tweak the script and save it, does the tweak change the script in all the forms? If so, does this happen upon reopenning each form in Designer? (i.e. each form still has to be reopened in Designer for the tweak to happen, right?). I feel like an idiot asking, but I'm long in lazyness this miserable, damp, dreary morning in Wisconsin. Even my little dog's energy has waned today.
    Cheers,
    Stephen

  • JavaScript functions in ADFLib - jdev 11.1.2.3

    Hello:
    I would like to create an ADF Library that has many JavaScript functions and any application that adds this ADF Library to its project should be able to use the javascript functions.
    Or is there a better way to accomplish this?
    I'm following the Enterprise Structure of creating ADFLibs for : Common Code, Common Model, Common UI
    Subsystems then import these ADFLibs
    The Master app, imports the ADFLibs and the Subsystems and uses subsystem taskflows in the Master to complete the application.
    In my case, I would like to execute the same JavaScript in both the Subsystem and the Master. So I think I should put the JavaScript in the Common UI adflibrary or what???
    What is the best way to structure this to be able to reuse the Javascript in multiple apps?
    Is there any articles/samples that you can reference?
    Thanks for the help.

    Thanks...
    I have watched this video. It was very helpful but not seemingly enough for this issue.
    My first try was to put the JavaScript in the CommonUI, but then I could not figure out how to reference it in the adflib as the JavaScript library is relative to the context path. So I still have not figured this out yet.
    Thanks for the help.

  • My after effects keeps crashing when i add effects i think it is due to disk cach?? help!

    My after effects cs6 keeps crashing when i add effects but it is random.. for example i might add 3 adj layers with effects on each .. different effects then randomly when i add say turbulent displace a window will pop up saying after effects has crashed due to... [ turbulent displace ]! also when i start up after effects it says there is not enough disk cach even though my disk cach is empty and i allow over 300 gb for it!
    please help! mabey i need to configure after effects more or something but any advise with be greatly appreciated.
    COMP SPECS:
    processor: AMD FX(tm)- 6120 six core processor     3.50 GHz
    Insatlled memory (RAM) 10 Gb
    system type: 64 bit
    hp envy!
    windows 8
    i dont use any major programs while running after effects cs6  and i give it maximum piority for usage!
    only programs used while after effects is running:
    skype
    youtube (mabey)
    pandora (mabey)
    thankyou,
    Nathan

    Exact crash info:
    Working with your Operating System’s Tools
    Mylenium

  • Confirm() javascript function -  I would like Yes/No instead of OK/Cancel

    Hi All,
    I am using the confirm() javascript function and it works great! BUT, I would like Yes/No instead of OK/Cancel.
    Is there another function or a way to change the names used by the function.
    <pre>
    function SubmitCmd(sCmd) {
    var lpartial = html_GetElement('P44_PARTIAL').value;
    if(lpartial == 'Y'){
    // Go see if this partial exists for this ISD
    var l_DIST = html_GetElement('P44_DDDCCC').value;
    var l_ISBN = html_GetElement('P44_ISBN').value;
    var l_BKTYP = html_GetElement('P44_BK_TYPE_CD').value;
    var lapp=html_GetElement('pFlowId').value;
    var lpg=html_GetElement('pFlowStepId').value;
    var get=new htmldb_Get(null,lapp,'APPLICATION_PROCESS=odpExistingPartial',lpg);
    get.add('G_ITEM1',l_DIST);
    get.add('G_ITEM2',l_ISBN);
    get.add('G_ITEM3',l_BKTYP);
    var lexisting = get.get();
    get=null;
    if(lexisting != 0){
    // Show Alert Question
    var conf= confirm("There was a partial found for this ISBN and ISD."+
         "<BR>Do you want to add this partial to the existing one"+
         " found?");
    if (conf) {
         // Set up to call existing copy in Partial screen.
         html_GetElement("P44_COPY_ID").value = lexisting;
         doSubmit('ADD_PARTIAL');
         return;
    doSubmit('CREATE');
    </pre>

    Hello,
    The confirm() function is a built-in JavaScript function which you can’t alter.
    You can build your own dialog box, with any text and options you need. Search Google for “JavaScript modal dialog” and you’ll get references to a lot of examples. Not all of them are trivial to implement within APEX.
    BTW, if you want your code to maintain its format, you should use the forum internal tags [ code] and [ /code] (without the blanks). This way your code will be readable.
    Regards,
    Arie.

Maybe you are looking for