JSP pages get cached

I have a jsp application where on some computers the pages get cached and on some they don't. For example, when you click on a button that takes you to the next set of records
1.     First time the request gets to the oc4j server, some code is executed and page number 2 is displayed
2.     Every following click on the same button causes the page number 2 to be displayed. Request never gets to the oc4j server.
It looks like the page is cached somewhere.
It happens on some computers and on some it doesn't. To me it seems that it depends on the browser settings but I can't find any difference between the computers where it works fine and those where it doesn't.

Deepak's suggestion is the solution on the server side and should be the right solution if your jsp should not be cached.
On the client side, have you checked the caching setting of your browser? In IE, go to "Internet Options" --> "Temporary Internet files" --> "Settings...". This might solve your initial question.

Similar Messages

  • Jsp page getting error when opened after opening a form

    Hi,
    I have created an OA page, there is a link and a button in this page.
    Whenever I click on the link, a standard jsp page will be opened in a new window.
    When the button is clicked a standard form will be opened.
    But when I click the button, and then click on the link then an error page is getting displayed with 'Logged in user does not have permission to access this page.' message.
    Please help me on this.
    Thanks.

    But when I click the button, and then click on the link then an error page is getting displayed with 'Logged in user does not have permission to access this page.' message.
    Do you mean to say that the link works if you click on it without clicking on the button? The jsp you are talking about is a seeded one or a custom? --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to keep user enter value in textbox even if JSP page get refreshed.

    Hi Experts,
    In My JSP Page i have one text(customer Name) and number of checkboxes and radio buttons.
    My Problem is:
    if user enter some value in Text Box and after that user clicks on some radio button becouse of some action on radio button page get refresh and also the value enter by user in text box get vanish.
    I want keep text box value as it is even if page get refreshed becouse of some action.
    Is it any setting in Strust framework for this.
    I am using Struts Framework.
    Please let me know if need more information

    Sorry, I don't clearly understand the question and the horrible code (Java code doesn't belong in JSPs) doesn't make it more easy to understand.
    Best what I can guess is that you need to learn about passing request parameters/attributes in JSP and the possibilty of storing attributes in the session. And based on the code, also learn how to separate the data, business and presentation layers properly.

  • JSP Page getting expired with in 2 or 3 minutes.

    Hi Experts,
    We have developed an j2ee application which runs on Oracle 9ias application server v 1.0.2.2. The operating system is IBM AIX so we are using IBM JDK 1.3.1. The problem we are facing is the session get's expired with in two three minutes. But the application server session time by default is set to 1200 seconds that is 20 mins. Initially we had a problem that the server often crashes writing some core dump. We could find a ultimate solution for this either from IBM or Oracle side.
    Right now we r able to run the applciation by specifying the heap with Xmsize option. Does this heap size setting have any relation with session object.
    How are session objects garbage collected. Is there a different algorithm for session object garbage collection.
    Expecting timely help from the Experts as this is crucial for us.
    Regards
    Barath Kumar

    The heap size shouldn't have anything to do with the expiration of the session. The only factors affecting session timeout should be the web.xml file (<session-timeout> tag under <session-config>) and any instances of session.setMaxInactiveInterval(int) in your code.
    There is a question that you should resolve before going any further; is your session timing out or is the container losing it?
    To test, create a class that implements HttpSessionListener and implement the sessionCreated and sessionDestroyed methods to give yourself a status message when the session is created and destroyed; a simple System.out.println will do the trick.
    Add your new class to the web.xml with a listener tag:<listener>
       <listener-class>somepkg.ListenerClass</listener-class>
    </listener>The new class should bind to the session on creation and let you know when the creation and destruction events take place; if you get a status message when the session is created, and subsequently lose session information without a message when the session is destroyed, then the container has dropped your session and you need to complain to Oracle.
    I've had exactly this problem; I believe there is a bug already filed, but I couldn't locate it quickly.

  • In JSP pages request.getParameter returns null

    There are two jsp's,the first JSP has 1 textbox inside the form tag.We input the values in the textbox and submit.
    Code :Ist jsp
    <BODY>
    <HEAD>
    function validate()
    document.add.submit();
    </HEAD>
    <FORM name="add" method="post" action=/dir/two.jsp" >
    <TABLE width="37%" border="0" align="center" class="c4f3">
    <TR>
    <TD class="c4">Rating</TD>
    <TD><input type=text name="rating"></TD?
    </TR>
    <TR>
    <TD align=center><INPUT type="button" name="submitadd" value="Submit" onClick="validate()" </TD>
    </TR>
    </TABLE>
    </FORM>
    </BODY>
    After the submit it goes to the 2nd JSP page .
    code:2nd Jsp
    <%
    String Rating=request.getParameter("rating");
    out.println(" Rating "+Rating);
    %>
    The 2nd JSP pages gets the values by request.getParameter.When I use method='post' in Ist JSP ,even if I enter values in the textbox, it prints null. But when I give method="get" , it prints the value.
    Pls let me know if there is any problem in the code or its the problem due to webserver configuration.Also suggest the solution to over come this problem.
    Thanks

    If I'am right you have misplaced the opening body-tag of your first jsp-page.
    The opening body-tag should follow after the closing head tag .
    The structure of your HTML-code should look like this:
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>

  • How to make controls static in jsp page

    Hello Friends.............
    I want to make controls or objects static which are on jsp page.
    i.e. when my window is maximized then every thing is perfect but when i restore my window all the controls on the jsp page gets destorted.....
    I want to make look that jsp page same in both the positions of window.
    1) When window is maximized.
    2) When window is minimized.
    The controls should not get destorted.
    Can any body please help me out in this issue....
    Thanks
    Sameer Rede

    This has nothing to do with JSP. It's all about HTML and CSS. You can use CSS to specify fixed sizes/locations for things, or you can use HTML tables to control layouts.

  • Need to refresh the jsp page

    Hello Everyone,
    I am not sure if I can tackle the below issue with just html or I need to control it throught my servlet, so posting it on this forum, in case it is a pure html issue, please let me know.
    So here is the current situation:
    My jsp page gets data from servlet and displays it in a html table. The fields are criteria, median, average...cells of average, median etc are color coded, green, yellow or red, depending on whether the criteria is met or not.
    on wish list:
    I want the column "criteria" to be of text type so that the user can change the criteria value and see what effect does it have on the colors of columns "average", "median" etc. I do not want to write this changed criteria value back to db, I just want my jsp page to refresh every time user changes value in criteria text box and recalculate the color code for the rest of the columns.
    Here is what my jsp page looks like
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="http://paginationtag.miin.com" prefix="pagination-tag"%>
    <html>
    <body>
      <table border="1">
        <c:forEach items="${sheetDataList}" var="releaseData">
        <tr>
          <td align="center"><input type="text" name="newcriteria" value="${releaseData.releasecriteria}" size="25"></td>
          <c:set var="yellowmark" value="${0.25*releaseData.releasecriteria+releaseData.releasecriteria}"/>
          <c:choose>
            <c:when test="${releaseData.average lt releaseData.releasecriteria}">
              <td bgcolor="green" align="center"><c:out value="${releaseData.average}"/></td>
            </c:when>
            <c:when test="${releaseData.average lt yellowmark}">
              <td bgcolor="yellow" align="center"><c:out value="${releaseData.average}"/></td>
            </c:when>
            <c:when test="${releaseData.average gt yellowmark}">
              <td bgcolor="red" align="center"><c:out value="${releaseData.average}"/></td>
            </c:when>
          </c:choose>
      </table>
    </body>
    </html>Thanks.

    I don't know what you are doing wrong in your code, but it seems like you are calling the JS function correctly. My feeling is there is some JS error occurring, maybe use a javascript debugger or some alerts to see where the problem is. I made as close a copy of your code I could (with some improvised improvements for keeping track of row counts and accessing the the values for the first 2 columns of the table). At the top I filled to Lists with data so I could cycle through the rows and columns. Then I do the JavaScript and the CSS, followed by the table generation.
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
        java.util.List<java.util.List<luke.steve.RowObject>> sheetDataList = new java.util.ArrayList<java.util.List<luke.steve.RowObject>>();
        for (int r = 0; r < 10; r++) {
            java.util.List<luke.steve.RowObject> userActionData = new java.util.ArrayList<luke.steve.RowObject>();
            for(int c = 0; c < 5; c++) {
                 userActionData.add(new luke.steve.RowObject());
            sheetDataList.add(userActionData);
        request.setAttribute("sheetDataList", sheetDataList);
    %>
    <html>
      <head>
        <script type="text/javascript">
        <!--
          function setAllColors() {
            var currentRow = 1;
            var row = null;
            while((row = document.getElementById("row"+currentRow)) != null) {
              setColors(currentRow);
              currentRow++;
          function setColors(currentRow)
            var criteria = document.forms[currentRow-1].criteria.value;
            var yellowLine = 1.25 * criteria;
            var row = document.getElementById("row"+currentRow);
            var currentCol = 2;
            do {
              var col = row.cells[currentCol];
              var colValue = col.innerHTML * 1;
                   if (colValue <= criteria)  col.className = "green";
              else if (colValue < yellowLine) col.className = "yellow";
              else                            col.className = "red";
              currentCol = currentCol + 1;
            } while(row.cells[currentCol] != null);
        //-->
        </script>
        <!-- Make the clock look the way you want it to. -->
        <style type="text/css">
          .green
           background-color: green;
          .red
            background-color: red;
          .yellow
            background-color: yellow;
        </style>
        <title>Color Switcher</title>
      </head>
      <body onload="setAllColors();" onunload="">
        <table border="1">
          <tbody>
            <c:forEach var="userActionData" items="${sheetDataList}" varStatus="rowCounter">
              <tr name="row${rowCounter.count}" id="row${rowCounter.count}">
                <td>${userActionData[0].userAction}</td>
                <td><form onsubmit="setColors(${rowCounter.count}); return false;"><input name="criteria" type="text" value="${userActionData[0].releaseCriteria}"/></form></td>
                <c:forEach var="releaseData" items="${userActionData}" varStatus="colCounter">
                  <td>${releaseData.ninetyPercentile}</td>
                </c:forEach>
              </tr>
            </c:forEach>
          </tbody>
        </table>
      </body>
    </html>I made a dummy class called luke.steve.RowObject to hold the data (represents on releaseData object). The class just generates a bunch of random numbers for this test:
    package luke.steve;
    public class RowObject {
         public Integer getReleaseCriteria() {
              return Double.valueOf(Math.random()*500.0).intValue();
         public Integer getNinetyPercentile() {
              return Double.valueOf(Math.random()*500.0).intValue();
         public String getUserAction() {
              return "Action "+Double.valueOf(Math.random()*10.0).intValue();
    }In this example it works in FF3 and IE7 (though it looks nicer in FF3).

  • Delay Loading JSP page

    I have a jsp page, it has got two frames, the upper one is an applet and the lower one is a jsp page. The jsp page tries to accesc the variable of applet. Since the jsp page gets loaded first it gets javascript error.
    Now i want to delay the jsp page from gettingloaded. It should load afer the applet.
    I cannot touch the applet because it contains truepass code.
    Please let me know how can i do it.
    Thanks
    Abhay

    To frustrate your users? Anyway, try Thread.sleep.

  • Are not interpreted JSTL tags in a JSP page including in a servlet.

    Hi people,
    I have a project where una page (index.jsp) includes a servlet (MyServlet), that consult a persistence class and get a List of objects (Users),      
    then the servlet passes the List to a Request object and includes another JSP page (showUsers.jsp). And this is conceptually correct, but don´t works, the JSTL tags are not interpreted in showUsers.jsp.
    This is my code...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <c:out value="Show me some things index.jsp"/>
    <div style="border-color:red; border:solid; padding-left:60px">
          <jsp:include flush="true" page="pepe/MyServlet"/>
    </div>
    </body>
    </html>...and the Servlet...
    public class MyServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              UserManager um = new UserManager();
              List users = um.getUsers(); //This use Hibernate to return a Users List
              request.setAttribute("users", (ArrayList) um.getUsers());
              request.getRequestDispatcher("/showUsers.jsp").forward(request, response);
    }...Finally, we have the showUsers.jsp file....
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="${requestScope.users}" var="user">
                   <td><c:out value="${user.id}" /></td>
                   <td><c:out value="${user.name}" /></td>
                   <td><c:out value="${user.email}" /></td>
                   <td><c:out value="${user.type}" /></td>
              </c:foreach>
         </tr>
    </table>This i get as result page...
    ID       Name       e-Mail       TypeFinally, this is the code of showUsers.jsp...
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
              </c:foreach>
         </tr>
    </table>Somebody can help me?
    Many thanks,
    Gonzalo

    Thanks you all guys,
    I appreciate very much your help. In response to everyone ...
    BalusC wrote:
    Is JSTL taglib declared in top of that JSP page? I don't see it back in the posted code snippet. In this example I stuck...
    request.getRequestDispatcher("/showUsers.jsp").forward(request, response);By mistake, but this is just a test, the original line of my servlet is...
    request.getRequestDispatcher("/showUsers.jsp").include(request, response);As you can see, both (the servlet and the showUser.jsp file) are included in the index.jsp file. So the header...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>...in the index.jsp file should works (I hope so).
    njb7ty wrote:
    I assume in your web.xml, you have ''pepe/MyServlet' defined as a servlet tag and servlet map tag? Without that, I don't think your JSP will find the servlet. I'm >not sure you need it in web.xml since I never call a servlet from a JSP page.
    I suggest putting System.out.println() throughout your servlet code and out.println() in your JSP pages to see exactly what is called and when.
    As a general rule, JSP files are to display data only, and submit back to a servlet. The servlet does all the business logic and dispatches to the appropriate >JSP page. The JSP shouldn't have any business logic. Including the servlet looks kinda like including business logic. Actually, in a MVC design, your >presentation, control, busines, and database layers have their own isolated responsibilities.
    I suggest the servlet put data as one java bean in request scope via request.setAttribute() and dispatch to the JSP page. The JSP page gets the data via ><useBean> tag. The JSTL gets the variables from the useBean tag and uses the data from there to display it. Really, this is my web.xml file...
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">
         <servlet>
              <servlet-name>MyServlet</servlet-name>
              <servlet-class>src.MyServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>MyServlet</servlet-name>
              <url-pattern>/pepe/MyServlet/*</url-pattern>
         </servlet-mapping>
    </web-app>Regarding putting System.out.println() and out.println(), i did it and thats works.
    Respect of your last comment, I am not a expert in MVC, but I understand that the view layer can make calls to the Controller layer, I am wrong?
    evnafets wrote:
    It's not. However thats not code, but the generated HTML.
    As Balusc pointed out it's the result of running this JSP page without importing the tag library at the top.
    Because the tag library is not declared, it treats the <c:forEach> and other tags as template text, and basically ignores them.
    It then evaluates the ${items} attribute as an expression in template text, calling toString() on it.
    Cheers,
    evnafets      The file showUsers.jsp are included into the index.jsp page, that's have the header taglib. Could this works?
    BalusC wrote:
    njb7ty wrote:
    By the way, I dont think this is the correct format for the foreach tag:
    <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">You're right friend.
    And that's my problem. Any ideas?
    Thanks everyone,
    Gonzalo

  • Second request to a JSP page

    When a second request is made to the JSP page, is the request sent to the servlet directly or is it handled by the JSP page. The question comes bcos when the JSP page is requested for a second time, a copy of the .class file is already available in the servlet container.

    hello,
    Even the first "request" is handled by the generated servlet! On to point, The JSP page GETS COMPILED ONLY ONCE after you install/modify it ,or on restart of server.Once a request is send to the jsp page ,the server checks for the time flag of the JSP file,and if it finds that the jsp page is modified,it recompiles the page,and send the request to the generated servlet for processing.Else it handles over the request to new servlet instance of precompiled servlet class.Note the diff in latency when you first call the JSP page and subsequent calls.This is because of foresaid reason.
    Just 4 fun try deleting the .class files in works folder,if u work on a tomcat.
    cheers
    [email protected]

  • How to get fresh jsp 'page' rather than from cache?

    Hello
    I am using about 5 jsp pages. some of the jsp call other JSPs. When a jsp calls another jsp (by button clicking), the target jsp opens but it does not shown the fresh contents. I have to make it fresh by clicking the fresh botton of IE explorer. How can I get fresh jsp when it is called from another jsp? Will be grateful for any help.
    I am using IE5 and tomcat4.0

    You need to tell IE not to cache your pages. For IE 5 something like this should work:
    <HTML>
    <HEAD>
    <TITLE>---</TITLE>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD>
    <BODY>
    </BODY>
    <HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD>
    </HTML>

  • How Can I speed  up the results on my JSP page with the help of Caching.

    I am generating a dropdown listbox by merging an xml file with a style sheet(xsl).
    This list box comes up fine without any problems. Now, I am adding some advanced
    logic to the
    style sheet (xsl) to use the same xml file in a more efficient way. This time
    the generation
    of the list box is taking much longer (upto 25 seconds) although I get the results
    I want.
    Is there any way I could speedup this process by using weblogics caching. I know
    the process is slowing down
    due to the code in the stylesheet. Will caching resolve this issue?. I tried
    using
    <wl:cache> </wl:cache> on the jsp page generating this listbox but found no improvement.
    Any help will be very much appreciated.

    turn off your phone, unplug your router, leace it off for 30 seconds, and then power it back on and turn the iphone back on

  • My jsp page does not get refreshed

    I have a jsp page which looks like -
    the top portion of the page has 3 textboxes and a submit button to add an entity.
    the rest of the page displays a list of all the entities in the system.
    when i load the jsp and add a new entity, the new entity shows up on the list. when i try to add a new entity second time, the entity does get added into the database, but does not show up in the list.
    In the action class, i make a request to the dao and print all the values from the list, returned by the dao. Since the newly added values are present in the list, returned by the dao, i dont think there is anything wrong with my business layer or the DAO layer.i dont understand, why it does not show up in the jsp page.
    any ideas. i am wondering if the data is being cached, so, in the jsp page i have also set the following parameters:
      <head><meta http-equiv="Expires" CONTENT="0"><meta http-equiv="Cache-Control" CONTENT="no-cache"><meta http-equiv="Pragma" CONTENT="no-cache">
    --------------------------------------------------------------------------------Has this to do anything with Struts and Hibernate which i use in my application? The same thing happens, when i edit. when i click on edit button, it takes the user to a different page, i edit the details and click on save button. the control returns back to the list page, but the changes are not shown, although the changes are saved to the db. how do i prevent cache. i am putting my entire list in a request object, before doing an action forward to the jsp page

    Hi,
    instead of using the cache in the meta tag try with the following lines,
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", 0); Regards,
    Bala A

  • How to implement content caching for jsp page ?

    Hello everyone,
    I am reading an article <Servlets and Jsp Best Practice>,at
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/#author, on one section it is saying :
    "Cache content: You should never dynamically regenerate content that doesn't
    change between requests. You can cache content on the client-side, proxy-
    side,or server-side. "
    Now I am working on a project. For every user, some of the content servlet generated will be the same for at least a week . I am thinking if I implement caching for these jsp pages, that would increase performace a lot.
    But I have no idea how to implement it either client-side or server-side, can someone give me a hint ?
    Thanks,
    Rachel

    You mean actually you are caching the response stream
    and the key to distinguish between different response
    streams are made of user's different request
    parameters. And the filter's function is to intercept
    the request to see if this request parameter's
    combination already exists in the Hashmap,then either
    use the cached response or forward to
    servlet.....really interesting...Do I get it right ?Yes that's it in a nutshell.
    >
    Then how do you build those response streams in
    advance ? You did it manually or have some mechanism
    to build it automatically ?
    The data gets cached the first time somebody visits the page.
    Find some examples on Filters, and take a look at the HttpServletResponseWrapper class. You need to cache response headers as well as the body. Another pitfall that you might run into is handling an If-modified-since header on the request. Don't cache the results of those requests.
    -Jonathan
    >
    Thanks again !
    Rachel

  • JSP page in a Struts Application not getting refershed

    I have made changes to one of the jsp file in a Struts project
    but even after refershing the page , loading the page thru Tomcat Manager 'Reload Applications ' , it's showing me the output of the old jsp page
    only
    Even , stopping & restarting Tomcat does no changes to jsp file
    What's the issue?
    How to resolve
    Regards

    Possibly:
    1. Browser could be caching the page.
    2. If you use a proxy, the proxy may be caching the page.
    3. The page is not getting recompiled.

Maybe you are looking for