Caching JSP output

All,
          Any help or pointers to solutions would be greatly appreciated.
          We have some JSPs that produce relatively static output. Is there a way in
          WL to cache the output, instead on recreating it every time? I know that
          the Caucho JSP engine will do this (it uses browser caching directives).
          Would we need to create our own caching mechanism?
          Thanks,
          Wade Matveyenko
          

Good idea, I'll file it as a per.
          Sam
          "Dimitri Rakitine" <[email protected]> wrote in message
          news:[email protected]...
          > Oh. Then why not use maxSize cache backed by the SoftReferences?
          > For example, in the BubblingCache store hard references:
          >
          > class KeyValuePair {
          > public Object key;
          > public Object value; // hard reference to prevent cached object
          > // from being gc'ed.
          > }
          >
          > in the sorted array and SoftReferences in the HashMap - that way it will
          > behave like a normal maxSize cache and, if we are lucky, will be able to
          > return cached objects even after their hard references are removedi
          (maxSize
          > reached). If the garbage collector is too eager to clear SoftReferences
          there
          > will be no performance penalty.
          >
          > Sam Pullara <[email protected]> wrote:
          > > Essentially, soft references in HotSpot are not useful as caches. Here
          is
          > > the bug/per from the
          > > Java Developer Connection:
          >
          > > http://developer.java.sun.com/developer/bugParade/bugs/4239645.html
          >
          > > What you find is that your newly made soft reference rarely makes it to
          the
          > > long term generation
          > > in the collector and thus gets cleared almost immediately. There is
          some
          > > stochastic effect that
          > > smoothes it somewhat over time but it is nothing like the perfect
          behaviour
          > > you get from the classic
          > > virtual machine.
          >
          > > Although the tag detects what VM it is in and determines a good default,
          > > there is the ability to
          > > force softreferences either on or off. You can set either
          >
          > > weblogicx.jsp.tags.CacheTag.softreferences=true
          > > or
          > > weblogicx.jsp.tags.CacheTag.nosoftreferences=true
          >
          > > To force it one way or the other. These are System properties, not
          WebLogic
          > > properties, so you
          > > will either need to set them on the command line with -D or you can use
          the
          > > special weblogic.properties
          > > syntax and prepend java.system.property to the property names to set
          them,
          > > like:
          >
          > > java.system.property.weblogicx.jsp.tags.CacheTag.softreferences=true
          >
          > > Some of the documentation is a tad out of date. There will be a more
          formal
          > > release of the tag library
          > > in the next release of the WebLogic Server.
          >
          > > Sam
          >
          > > "Dimitri Rakitine" <[email protected]> wrote in message
          > > news:[email protected]...
          > >> It says: 'Unfortunately, due to incompatibilities with the HotSpot's VM
          > > and the Classic VM, we must
          > >> not use soft references when we are running within HotSpot. '
          > >>
          > >> Could you please elaborate what these incompatibilities are?
          > >>
          > >> Thanks.
          > >>
          > >> Sam Pullara <[email protected]> wrote:
          > >> > Service Pack 5 includes a cache tag. Attached is a war file with the
          > >> > javadocs.
          > >> > You should find it in lib/weblogic-tags-510.jar or use the one in the
          > > war
          > >> > file.
          > >>
          > >> > Sam
          > >>
          > >> > "Dimitri Rakitine" <[email protected]> wrote in message
          > >> > news:[email protected]...
          > >> >> You can use squid (http://www.squid-cache.org) in front of your
          > >> >> Weblogic server(s) - it will do caching for you.
          > >> >>
          > >> >> Wade Matveyenko <[email protected]> wrote:
          > >> >> > All,
          > >> >> > Any help or pointers to solutions would be greatly appreciated.
          > >> >>
          > >> >> > We have some JSPs that produce relatively static output. Is there
          a
          > > way
          > >> > in
          > >> >> > WL to cache the output, instead on recreating it every time? I
          know
          > >> > that
          > >> >> > the Caucho JSP engine will do this (it uses browser caching
          > > directives).
          > >> >> > Would we need to create our own caching mechanism?
          > >> >>
          > >> >> > Thanks,
          > >> >> > Wade Matveyenko
          > >> >>
          > >> >> --
          > >> >> Dimitri
          > >> >> http://dima.dhs.org
          > >>
          > >> --
          > >> Dimitri
          > >> http://dima.dhs.org
          >
          > --
          > Dimitri
          > http://dima.dhs.org
          

Similar Messages

  • Help on jsp:output

    I am trying to use the <jsp:output> tag within jdeveloper10.1.2, but it is not included within the tags for JSP in the component pallete, so I keep getting an error. Any idea, pls ?

    jsp:output is a J2EE 1.4 JSP 2.0 tag.
    JDeveloper 10.1.2 provides only the JSP 1.2 tags.
    http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html
    JDeveloper 10.1.3 supports J2EE 1.4 (JSP 2.0).
    Some of the JSP 2.0 tags are not in the Component Palette.
    jsp:output tag, jsp:invoke and jsp:text tags which are jsp 2.0 tags are not in the Component Palette.
    http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html

  • Extra white spaces in JSP output

    Hi,
              My JSPs contain a large use of JSTL and other custom Tags.
              The problem is that the output contains too many new lines and spaces.
              I found out that APACHE Tomcat has a servlet parameter (trimSpaces=true) that solved this problem.
              Does Weblogic (9.1) have something similar ?
              Does JSPC / APPC have a special options that can solve this ?
              please advise,
              Avivi.

    Before diving into this, one thing I would ask you: Why does it matter if there are extra spaces? Did you determine that your primary users are using a slow connection? Before trying to optimize this, make sure that you really have a problem to solve. You might try saving off the currently generated HTML into a test page, and compare it to a similar one with all ignorable spaces removed. If you see no difference in performance, then don't bother doing this.
              Nevertheless, one strategy for reducing empty space in JSP output is to put the ends of the JSP directives and actions on the next line, with no newlines after them.
              For instance, a pair of lines like this:
              <%@page import="foo.bar" %>
              <%@page import="bar.foo" %>
              Would be instead:
              <%@page import="foo.bar"
              %><%@page import="bar.foo"
              %>

  • IE don't display JSP output. It pop up download dialong and open Dreamwea

    IE don't display JSP output. It pop up download dialong and open Dreamweaver.
    I dont' know why, but when run in Netscape is OK
    Anyone please help.

    Looks like your problem lies by the file associations, i.e. extension of your jsp file (.JSP) is associated in your operating system with DreamWeaver rather than with IE. If you are using Windows you should be able to change file associations, so that all web pages including JSP will be opened in your browser.

  • Ajax is caching the output and not updating the page.If you force a second postback after you should have seen a popup (but didn'), you then see popup displayed

    Ajax is caching the output and not updating the page.If you force a second postback after you should have seen a popup (but didn'), you then see popup displayed

    Hey, thanks for replying. It is the user who needs to manually submit the page.
    Basically our page has a hidden div with various text fields and combo boxes. When the user click on specific links on the page, this div is populated and made visible to the user in server side code.
    What happens for all other browsers other than firefox 23 onwards (worked fine in 22) is that after the user clicks on the link, our server side code is executed via a HTTP post. The server then renders the hidden div and sends the additional HTML down to the browser via ASP.NET AJAX.
    With Firefox 23, the additional HTML is not rendered on the first postback. Subsequent clicks of the same link execute the same server side code but the additional HTML is rendered on the browser without issue.
    We've done a lot of debugging now and the issue is localised to a specific third party supplier's (Infragistics) control. I think Firefox 23 must have changed the way that the viewport or screen bounds are calculated or reflected back to this control as the issue seems to stop when we remove the control's MaintainPositionOnScroll attribute. It might be that the Firefox 23 DOM is not able to provide the screen dimensions accurately when the page is first rendered. I say this as the second postback renders the additional HTML fine.
    The control in question is quite an old version so I don't think it's your issue to be honest.
    Just so that this might be helpful to other developers using the Infragistics Window Dialog Control, setting MaintainPositionOnScroll to false solved this issue for us.

  • Saving JSP output to a file

    I need to be able to save what a user sees on his browser, to a local file (where the web app runs).
    The content is dynamic. It is being created using a JSP.
    One way to write it to a local file would be to move the content creation from a JSP to a servlet and write to the HTTP response as well as to a file in the servlet.
    That's going to make it look messy.
    Any thoughts on how I could make this happen while continuing to use a JSP?

    OK, so now I've tried it, it's essentially what is described in the J2EE tutorial:
    /* File 1 */
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * passes on a subclass of HttpServletResponseWrapper
    * in order to replace the output writer.
    public class OutReplacementFilter implements Filter {
      public void init(FilterConfig filterConfig) throws ServletException {  }
      public void destroy() {  }
      public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                  throws IOException, ServletException {
        //wrap the original response
        HttpServletResponse newResponse = new ReplacementHttpServletResponse((HttpServletResponse) response);
        //pass it to the resource
        chain.doFilter(request, newResponse);
        //get what the resource wrote
        String output = newResponse.toString();
        //put it to the output stream
        PrintWriter out = response.getWriter();
        out.write(output);
        out.close();
        //and then put it where ever else you like
        System.out.println(output);
    /* File 2 */
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * returns specialized writer to capture jsp output
    public class ReplacementHttpServletResponse extends HttpServletResponseWrapper {
      private CharArrayWriter replacementWriter;
      public ReplacementHttpServletResponse (HttpServletResponse response) {
        super(response);
        replacementWriter = new CharArrayWriter();
      public PrintWriter getWriter() throws IOException {
        return new PrintWriter(replacementWriter);
      public String toString() {
        return replacementWriter.toString();
    }This way is easy and few keystrokes, but buffers all the output until the filter chain returns.

  • How to Buffer JSP Output Inside A Servlet

    Hello, we are trying to Process a JSP page inside a servlet and then do more processing and finnaly add the JSP output to the response output stream. I know there is a RequestDispatcher that lets you include a JSP page. However as far as I know all you can do with the RequestDispatcher is either include the JSP (which does not buffer it but simply adds it to the output stream) or forward to the JSP page. Any ideas? Thanks, - dk

    http://forum.java.sun.com/thread.jsp?forum=33&thread=377214

  • Opera browser caches .jsp pages

    Opera caches .jsp pages.
    This is serious and very annoying because it means that even if I click on the link that leads to the .jsp page I don't see a page with the current situation, but an older one.
    I know that you just use pragma, no-cache etc. in the page to stop caching, but if you use that solution, it also means that you can't use the back button because you won't find the page anymore.
    What I want to do is to say, if the browser is Opera, don't take the cached page, make me a new one.
    Anyone know how to force it not to take a cached page?
    Any help appreciated.

    Are you sure it is Opera, and not a Proxy? We had a problem that looked like the browser but was actually the proxy (because the user that reported it was the only person behind the proxy). At any rate, we handled proxy caching AND browser caching using fake URLS. E.G., When we had a page like http://site/page.jsp that could not ever be cached, we added a bogus parameter that was guaranteed to be unique: http://site/page.jsp?bogusParam=1AFFSDD2. That way the URL was never the same twice and even if the browser or proxy cached it wouldn't matter. Another option if you are using a servlet is to use the path:
    http://site/myservlets/servlet
    becomes:
    http://site/myservlets/1AFFSDD2/servlet
    and you just map that servlet to myservlets/*.
    More hassle, but at least it is workable.

  • Caching JSPs and images...

    I have recently started using pragma's to stop the browser caching jsp files:-
    response.setHeader("Pragma","No-cache");
    response.setHeader("Cache-Control","no-cache");
    response.setDateHeader("Expires",0);
    But will that stop the browser from caching images associated with the page ? I have a background image, which whilst not large, would cause alot of additional bandwidth consumption if it had to be downloaded with every jsp page request.
    Thanks.

    To be honest with you, the browser decides.
    The specification states that if you decide to refresh a web page, the browser should first check to see if there's a new version. If there have been no changes, it should use the version that's already in your "temporary files". The no cache directive is supposed to tell the browser not to bother checking, but go ahead and download the web page again.
    This applies for everything that's on the page. So yes, it would download the background again.
    However, I image that some of the latest generation browsers (such as Opera, Konq, Mozilla and Safari) bend the rules slightly. They recognize that an image is a background image because it's in the body tag, likely to be repeated throughout an entire site, and thus always checks for a new image regardless of whether you cache it or not.
    No cache is just a suggestion, not a requirement. If you're developing in a corporate workspace where everyone is using IE (for example), then I would go ahead and just test it.
    Keep in mind that if your JSP page has to dynamically generate content (usually by accessing a database), then the Servlet Engine always informs the browser that it is a new page. You don't need need to specify no cache in order to get the browser to always look for the most recent version.

  • JSP output affected with cookievalue cookie.getValue() function

    i need to output from a jsp
    fquid=uid@domain
    authtype=plaintext
    this is the format expected by a calling url.
    uid is dynamic
    case 1: if i set
    String uid="xyz";
    the calling url to this jsp behaves perfect. all it matters at this point is that the calling jsp needs output in the above format.
    here is the code that works.
    <%
    out.println( "fquid=xyz@domain\n");
    out.println( "authtype=plaintext\n");
    %>
    case 2:
    my job is to make this jsp dynamic. i need to grab the uid from a cookie and output the exact same strings. but this one bombs meaning the calling jsp does not behave correctly.
    here is the code i haveth:
    <%
    String cookieName = "cookiename";
    Cookie cookies [] = request.getCookies ();
    Cookie myCookie = null;
    String cval = null;
    if (cookies != null)
    for (int i = 0; i < cookies.length; i++)
    if (cookies .getName().equals (cookieName))
    myCookie = cookies[i];
    // out.println( i + "," + myCookie.getValue() + "<BR>");
    cval=myCookie.getValue();
    break;
    String uid=myCookie.getValue();
    out.print( "fquid=" + uid + "@domain\n");
    out.print( "authtype=plaintext\n");
    %>
    the moment i introduce myCookie.getValue() function into the code the calling url fails. the output of the both the snippets is same.
    what is the problem here?
    thanks
    bhanu

    Did you even set the Cookie? You need to set it first in order to get it.
    To set a cookie
    1. Create a new Cookie object and set the name and value in it's constructor.
    2. Then add the Cookie into the HTTP Response
    3. Call the above code from a URL
    4. Look in Browser's cache to verify if the Cookie was written
    Also check if Cookies are disabled in the browser.

  • Redirecting JSP output

    What is the best way to run a jsp in my web application without sending the output to the client? For example, I may want to save the output to a file or send it through a converter to remove the unnecessary leading spaces by sending the output through my own output stream.

    I think you need a servlet filter (I haven't used them before). This link discusses them:
    http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html
    The third page of the link talks about a cache filter which may help you.
    If the link isn't enough, I suggest reading up more on servlet filters..

  • JSP output does not change on Weblogic 5.1 / Visual Age 3.5

    I'm making developmen on Weblogic 5.1 and Visual Age 3.5.
              I change a JSP and when I reload it in my browser, I can see that the
              page is actually being recompiled, and if there are errors in the
              page, error messages are being displayed.
              However, if the page compiles without the error, it displays the
              output of the previous version of the page. No matter what I do, the
              page does not reflect the changes. The only solution is restarting
              the server.
              What might be the cause of this problem?
              Thanks,
              Sadik
              

    I'm making developmen on Weblogic 5.1 and Visual Age 3.5.
              I change a JSP and when I reload it in my browser, I can see that the
              page is actually being recompiled, and if there are errors in the
              page, error messages are being displayed.
              However, if the page compiles without the error, it displays the
              output of the previous version of the page. No matter what I do, the
              page does not reflect the changes. The only solution is restarting
              the server.
              What might be the cause of this problem?
              Thanks,
              Sadik
              

  • Post-Processing JSP output

    I need to strip out any white space from the JSP�s HTML output, since the 3rd party browser I�m developing for has numerous bugs when it encounters white space between HTML tags� (Especially with nested tables)
    I�ve prototyped the following code sample that uses javax.servlet.jsp.tagext.BodyContent to accomplish that (seems to work with Tomcat). Does anyone know of a better way to accomplish this task or if the code below could be causing some internal problems or breaking some JSP rules?
    <%@ page contentType = "text/html" %>
    <%
    BodyContent body = pageContext.pushBody();
    out = body;
    %>
    <html>
    <head>
         <title>Untitled</title>
    </head>
    <body>
    <table border="1">
    <%
    for (int i=0; i<3; i++)
    %>
    <tr>
    <%
    for (int j=0; j<3; j++)
    %>
    <td><%=i%>,<%=j%></td>
    <%
    %>
    </tr>
    <%
    %>
    </table>
    </body>
    </html>
    <%
    out = pageContext.popBody();
    java.io.Reader reader = body.getReader();
    boolean start = false;
    int c;
    while ((c = reader.read()) != -1)
    if (c == '<')
    start = true;
    else if (c == '>')
    start = false;
    if (start)
    out.write(c);
    else if (c != ' ' && c != '\r' && c != '\n' && c!= '\t')
    out.write(c);
    %>

    check out Coldjava's stuff:
    http://www.servletsuite.com/
    there are custom JSP taglib (Optimize) and
    Java servlets filter (Trim) for this task
    exactly.

  • How to display the JSP output in the same page....

    im new to JSP..... can anyone tell me how to display the output of a particular JSP page in the same page itself...... if anyone could send a small sample code it will be very useful for me....
    thanks in advance
    regds
    Krish......

    Hi Robert -
    When you say you are writing a template-based Renderer, do you mean that you are creating a custom look and feel and replacing the header Renderer? If so, I'd recommend instead simply creating your own template (not template-based Renderer), and reference your template directly from your uiXML pages where you want to insert the timestamp.
    You'll probably want to write a method data provider which calls System.currentTime(), convert the result to a date, and then use Java's date formatting capabilities (see java.text.format.DateFormat) to produce a user presentable String that you can return from your data provider.
    For more info (and samples) on templates and data binding, see the "Templates and Data Binding" section of the "Includes and Templating in ADF UIX" help topic:
    http://tinyurl.com/5b7bf
    Andy

  • Portal : JSP : Output in an Excel File.

    Hi,
    I am unable to get the output on a JSP Page in Microsoft Excel
    I am trying to generate an Excel Report from my Portlet. I am picking up the data for the Report from Oracle Internet Directory.
    I have created a simple JSP file ( as a Portlet ) and deployed it on Oracle App Server. I then registered a new Provider for the deployed JSP Page and added the JSP as a Portlet in a new Portal Page.
    I am trying the following code snippet in the JSP :
    <%@ page contentType="application/vnd.ms-excel"%>
    I get this weird error :
    AbstractResourceRenderer.renderBody - received IOException
    java.io.UnsupportedEncodingException: Media Type of a TextResponseWrapper must start with "text/"
    If I am correct, Portal should support this feature. I must be able to publish reports to an Excel File.
    I am new to Oracle Portal and I find this strange. The JSP page works fine in JDeveloper, but when I access it via Oracle Portal, I get the " UnsupportedEncodingException ".
    I posted my question on Metalink and was told to post my question in this forum.
    I am not sure if I need to post any other information or Configuration Settings - please do let me know if any other information is necessary.
    Thanks,
    Sandeep.

    Ok,
    After many sleepless nights and a long struggle, we were able to arrive at a workaround - simple & something that works.
    We created a Servlet ( not a Portlet ) that generates the Excel File. The Servlet is not a Portlet and as such is not restricted in the content-types that it can use. We let the user arrive at this Servlet via a simple HTML link.
    Well, that's about it ! I just wanted to post this so that anyone else tearing their hair apart with the same issue can find some solutions.
    Still, I strongly feel that a superb product like Oracle Portal should support the various content types.........
    Regards,
    Sandeep

Maybe you are looking for

  • How can I sort photos from two users into one

    I have two users on my Mac and I am trying to get all my photos onto my new External hard drive.  I want one user, one photo library stored on my external hard drive.  Help!

  • Not able to see 0doc_number object

    Hi, I  have created sales organization dimension I want to take 0doc_number ( sales document) using info object direct input but I am not able to see 0doc_number object Regards, Vivek

  • Using Developer against DB2 on OS/390

    I have read the document "Using Oracle Developer and the Oracle Open Client Adapter to access ODBC Data Sources". There is a chapter on how to use Developer agasint DB2/400. Is there information on how to use Oracle Developer gainst DB2 running on ma

  • Playlist in RealOne Player on N93

    Hello everybody, Could someone help me, please. how can I create a video playlist for real player in nokia N93 ?? thank you in advance, regards, Lukasz

  • Jdbc error on NT

    Hi: I put the "%ORACLE_HOME%\BIN;%ORACLE_HOME%\JRE11\BIN;" in the PATH and put the "%ORACLE_HOME%\jdbc\lib\classes111.zip" in the CLASSPATH. But there is the error message on running time. Java Exception error '80004005' java.lang.UnsatisfiedLinkErro