CFERROR type = "REQUEST" -- How to dynamically display ERROR page?

I applied the cferror tag in Application.cfm:
<cferror type = "REQUEST"
template = "../applications/main/view/dspError.cfm"
mailTo = "[email protected]">
The CF error template does not dynamically show variables
except the error message (I'd like it shows header, menu bar,
footer, etc.) . Is any way to display the error page with CF
variables / URL variables / form variables?
Thanks in advance,
Kevin

Using an onError function in an application.cfc file will
give you more flexibility than using a cferror tag.

Similar Messages

  • Problem displaying error page of web.xml when using JSF, Ajax4jsf

    Hi,
    My application is using MyFaces, RichFaces and Ajax4jsf. When i try to display error page configured in web.xml, i am getting exception "Error while processing error page".
    my web.xml contents are as follows:
    <?xml version="1.0"?>
    <web-app version="2.4" 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">
    <filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>faces</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter>
    <filter-name>extensionsFilter</filter-name>
    <filter-class>
    org.apache.myfaces.webapp.filter.ExtensionsFilter
    </filter-class>
    <init-param>
    <description>
    set the size limit for uploaded files. Format: 10 - 10 bytes 10k
    - 10 KB 10m - 10 MB 1g - 1 GB
    </description>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>100m</param-value>
    </init-param>
    <init-param>
    <description>
    Set the threshold size - files below this limit are stored in
    memory, files above this limit are stored on disk.
    Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
    </description>
    <param-name>uploadThresholdSize</param-name>
    <param-value>100k</param-value>
    </init-param>
    </filter>
    <filter>
    <filter-name>Seam Redirect Filter</filter-name>
    <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
    </filter>
    <filter>
    <filter-name>KTServletFilter</filter-name>
    <filter-class>com.kenexa.core.system.KTServletFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>extensionsFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>extensionsFilter</filter-name>
    <url-pattern>/faces/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Seam Redirect Filter</filter-name>
    <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>KTServletFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    <!-- seam Listeners -->
    <listener>
    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
    </listener>
    <listener>
    <listener-class>com.kenexa.kr.web.KRServletListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>faces</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>faces</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/rc/systemError.jsf</location>
    </error-page>
    </web-app>
    As per the configuration, when exception is thrown out of the application, container tries to display systemError.jsp page. If we want to include the JSF tags in systemError.jsp page, the request should pass through FacesServlet, so in the <error-page> <location> tag systemError page is specified with the extention systemError.jsf though it's actual extention is .jsp
    When exception is thrown from the application container invoke the error page but, while rendering systemError.jsf page exception is thrown saying "Exception processing error page "systemError.jsp" "
    To solve this problem i've gone through several forums, materials.
    In one forum a guy said, JSF1.1 spec has some problem in displaying error pages. To solve this don't write <f:view> tags in the error page, use <f:subview> intstead. By reading this, i again changed the contents of systemError.jsp page replacing <f:view> by <f:subview>. But the error is still repeating.
    Finally what i found is, when we use Ajax4jsf in the application, its AjaxViewRender class is throwing exception while rendering error pages configured through web.xml.
    So what i did is i changed error page extention from .jsf to .jsp in the <location> tag. Now jsf won't come in the picture and remove JSF related tags from the systemError.jsp page.
    <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/rc/systemError.jsp</location>
    </error-page>
    Any comments are welcome----------------------------------------------------------------

    I too iam facing the same problem could you advise if you have found any solutions
              -Ram

  • Dynamically display the page numbers on forms

    Hi,
    I have 10 pages in a form with the common footer section/fap in all pages. I used the common footer section to maintain the consistent left and right footer (having State specific footer information) on all ten pages. But I would like to display the page number dynamically based on page number as specified below:
    For example, for page 1, it should display the footer as Page 1A,for page 2 it should display as Page 1B, for page 3 it should display as Page 1C etc.,
    Can anyone help me on this issue how can I dynamically display the page number based on the current page as per the above requirement.
    Thanks,
    Srini.
    Edited by: 943696 on Jul 9, 2012 4:39 PM
    Edited by: 943696 on Jul 9, 2012 4:44 PM

    Ignoring the fact that you have 10 pages that you want to label all as "page 1", assuming you have version 11.4 (? or higher) you might be able to do this.
    Somewhere around that version the concept of "Print time" fields was introduced where you can define a field that will make a call-out to generate the value at the point in time when it tries to print.
    You would name the field something like: ~DAL MyPageValue
    Yes, with the tilde next to DAL and a space between DAL and the name of a script you want to execute that would do your calculation. As the previous reply mentions, you would have to keep track of your own page counter to know whether to append the 'A', 'B', 'C', etc. to the "Page 1" description you intend.

  • How to dynamically display .flv files in website

    I'm using a JSP for my interface.?? In the webpage, I want to pass a java variable, which holds the url to the video that was retrieved from the database, to the flash player script to dynamically determine which video to play.?? For example, this code in the page will play a movie successfully:
    <td><script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','widt h','706','height','633','id','FLVPlayer','src','FLVPlayer_Progressive','flashvars','&MM_Co mponentVersion=1&skinName=Halo_Skin_3&streamName=movies/Video1_1&autoPlay=true&autoRewind= false','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage',' http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','FLVPlayer_Progressive' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="706" height="633" id="FLVPlayer">
    ?????????????????????????????? <param name="movie" value="FLVPlayer_Progressive.swf" />
    ?????????????????????????????? <param name="salign" value="lt" />
    ?????????????????????????????? <param name="quality" value="high" />
    ?????????????????????????????? <param name="scale" value="noscale" />
    ?????????????????????????????? <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=movies/Video1_1&autoPlay=tr ue&autoRewind=false" />
    ?????????????????????????????? <embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=movies/Video1_1&autoPla y=true&autoRewind=false" quality="high" scale="noscale" width="706" height="633" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />??????????????????????????
    </object></noscript></td>
    But this code will not play the movie successfully:
    <td><script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','widt h','706','height','633','id','FLVPlayer','src','FLVPlayer_Progressive','flashvars','<%= flashVars %>','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','FLVPlayer_Progressive' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="706" height="633" id="FLVPlayer">
    ?????????????????????????????? <param name="movie" value="FLVPlayer_Progressive.swf" />
    ?????????????????????????????? <param name="salign" value="lt" />
    ?????????????????????????????? <param name="quality" value="high" />
    ?????????????????????????????? <param name="scale" value="noscale" />
    ?????????????????????????????? <param name="FlashVars" value="<%= flashVars %>" />
    ?????????????????????????????? <embed src="FLVPlayer_Progressive.swf" flashvars="<%= flashVars %>" quality="high" scale="noscale" width="706" height="633" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />??????????????????????????
    </object></noscript></td>
    The only difference in the two is that in the second, I use a java variable to set the flash Variables. The variable I use is <%= flashVars %>?? which is equal to: &MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=movies/Video2&autoPlay=false&autoRe wind=false
    When I view the resulting page source code after building and running the site, The source code is exactly the same for both of them yet one works and one doesn't.?? Any help would be greatly appreciated!

    I've been searching google all day to figure this one out.  I'm not simply trying to play a video, I can already do that... I'm retrieving the location of the video from the database and trying to pass it as an argument to the player, no different than if I was dynamically displaying an image or some text. For some reason I'm not able to do this.

  • How to Dynamically Display Different ViewStack component without using State?

    I have a type column in a datagrid record, when type = A, I want to display ViewStack A, when type = B, I want to display ViewStack B, any body can give me some clues? sample code is best. Thanks a lot. BTW, I don't want to use state to control them, as both ViewStacks are already within the same application state.

    hi,
    you can try something like this.....
    David.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.events.ListEvent;
    [Bindable] private var arr:ArrayCollection = new ArrayCollection([
    {info:"record 1", type:"A"},
    {info:"record 2", type:"B"},
    {info:"record 3", type:"A"},
    {info:"record 4", type:"B"}
    protected function dg_changeHandler(event:ListEvent):void
    if (arr[dg.selectedIndex].type=="A") tn1.visible = true else tn1.visible = false;
    tn2.visible = !tn1.visible;
    ]]>
    </mx:Script>
    <mx:DataGrid id="dg" x="279" y="239" dataProvider="{arr}" change="dg_changeHandler(event)">
    <mx:columns>
    <mx:DataGridColumn headerText="Info" dataField="info"/>
    <mx:DataGridColumn headerText="Type" dataField="type"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:TabNavigator x="279" y="408" width="200" height="200" id="tn1">
    <mx:Canvas label="Tab 1" width="100%" height="100%">
    </mx:Canvas>
    </mx:TabNavigator>
    <mx:TabNavigator x="507" y="408" width="200" height="200" id="tn2">
    <mx:Canvas label="Tab 1" width="100%" height="100%">
    </mx:Canvas>
    </mx:TabNavigator>
    </mx:Application>

  • How to call common error pages for all the exceptions

    Hi All
    I have created the common ErrorPage in my application. In case of any error whether SQL,IO or JBO I want that error page be displayed. In the page definition I have given the errorpage name and also defined the error page as IS_ERROR_PAGE = true.But it is throwing Jbo exception at the top of the page itself.No redirection to the error page is done.
    Though I have gone through various threads in this forum but still its not clear how to get the things working.
    Can anyone please help me out in this regard?

    Hi,
    I assume you mean that you set the error page in the web.xml file. Note that exceptions are handled first by the JSF framework. Please have a look at the developer guide
    http://download-uk.oracle.com/docs/html/B25947_01/toc.htm
    http://download-uk.oracle.com/docs/html/B25947_01/web_val008.htm#CIHHBEEJ
    Frank

  • How to show  an error Page in Weblogic when the server is down

    Hi ,
    I heard that every container has the facility to show an error page when the server is down and (when the request has arrived at that time ).
    Please tell me how to configure this in BEA weblogic ??
    Thanks .

    Hi,
    From my understanding weblogic dose not provide the thing which you are asking for, reason is given below.
    - An application is deployed only on managed server one (MS-1)
    - Now if the request comes to the server (MS-1) when it was running and then for some reason MS-1 goes down then weblogic server would be able to send any response back to the client as its down.
    - Hence nothing can be done as the request object is been lost when the server goes down or even cant redirect to an error page as for doing that too the server has to be up and running.
    However there are other way round which can help you overcome this issue as shown below
    - Use Clusters with few managed servers in it which gives you high availability and load-balancing.
    - Use any web servers like Apache in front of weblogic servers.
    Using the above things you can also use customized HTTP Error Responses with error-page element in web.xml and create your own error pages which can be re-directed for the web server side also. For more information go through the below links
    Topic: Customizing HTTP Error Responses
    http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webapp/configurejsp.html#wp157884
    Topic: error-page
    http://download.oracle.com/docs/cd/E13222_01/wls/docs81/webapp/web_xml.html#1017571
    Topic: ErrorPage
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/plugins/plugin_params.html#wp1155425
    Hope above information helps you.
    Regards,
    Ravish

  • How to configure custom error page in WebServer 6.1 if instance is down

    Hi ,
    I have deployed an application on port 82.
    If the instance is down, want to configure custom error page in Sun One Webserver 6.1 so that the it displays a customised message rather than browser displaying its custom DNS error page.
    In web.xml, configured the 404/500 error messages, but if the instance is down, my web application does not receive the request. So it should be defined at the root level.Where to configure the same?
    Thanks for the help in advance.

    You can use Error function "send-error" http://docs.sun.com/source/817-1834-10/crobjsaf.html#wp20007
    It has an example
    Error fn=send-error code=401 path=/sun/server61/docs/errors/401.html

  • How to Config Special Error Page for TIME OUT ONLY

    We can config our own error page for webdynpro applications by using
    transaction code SICF. thus the customizing error page will show when
    program meet some errors. these errors type include ABAP runtime
    dump/page time out etc.
    Here is my question, is there any configuration or enhancement can
    effect on ONLY ONE error type.which means the customizing error page
    shows only time out error occurred.for other errors show the standard
    error page.
    Thanks a lot for your help.

    I need to setup a situation, that is display a custom error page which say "under maintenance" if no back-end WebLogic Server instance reached.In the Apache HTTP Server v2.2 you can use the ErrorDocument directive: http://httpd.apache.org/docs/2.0/mod/core.html#errordocument
    For example in httpd.conf,
    ErrorDocument 503 /Test.html
    Test.html is placed in the DocumentRoot (http://httpd.apache.org/docs/2.0/mod/core.html#documentroot)
    Regards
    Fabian

  • Display error page using web.xml error-page

    I need to dispaly error page when IOException in thrown. How to do that with web.xml error-page tag?
    start.jsf
    public String doButton1Action() throws IOException{
              String value = getText1().getValue().toString();
              try {
                   File f = new File(value);          
                   InputStream in = new FileInputStream(f);
              } catch (IOException e) {
                   throw new IOException();
              return "success";
         }I have this in web.xml:
         <error-page>
              <exception-type>java.io.IOException</exception-type>
              <location>/ioerror.jsp</location>
         </error-page>

    I tried that earlier but then I get error just printed to console and HTTP 500 - Internal server error -page, bubt not my errorPage.
    [26.1.2007 21:19:16:543 EET] 00000038 jsf           E com.sun.faces.lifecycle.InvokeApplicationPhase execute #{pc_Start.doButton1Action}: javax.faces.el.EvaluationException: java.io.FileNotFoundException: c:\temp\ghostfile.jpg
                                     javax.faces.FacesException: #{pc_Start.doButton1Action}: javax.faces.el.EvaluationException: java.io.FileNotFoundException: c:\temp\ghostfile.jpg
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
         at javax.faces.component.UICommand.broadcast(UICommand.java:312)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:298)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:412)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
         at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
         at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
         at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
         at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
         at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
         at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
         at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
         at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
         at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
         at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
         at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
         at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
         at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
    Caused by: javax.faces.el.EvaluationException: java.io.FileNotFoundException: c:\temp\ghostfile.jpg
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:131)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
         ... 25 more

  • [Forms9i] Display error page

    Hello,
    How can i do to display my own html error page to user when Forms Sercice is not avalaible ?

    Hello,
    How can i do to display my own html error page to user when Forms Sercice is not avalaible ?

  • Displaying error page when not entitled to use the portal

    Hi,
    We are using BEA Portal 8.1 and would like to display an error page to a user
    who is authenticated but not entitled to view any of the portal resources. Does
    anyone know how to do this?
    Here are more details:
    Users are authenticated by Netegrity Siteminder when they logon to the LAN. An
    authenticated user may or may not be entitled to use the portal site depending
    on attributes passed in the header by netegrity. These attributes values are stored
    as user profile properties. Visitor entitlements have been created based on these
    properties and pages/portlets are then entitled through these visitor entitlement
    roles.
    If a user is not a member of any roles, then they should be redirected to a page
    indicating that they do not have permission to access the portal. Howe can this
    be implemented?
    Thanks.

    Hi Lilybiri,
    Thanks for your quick response. I followed your suggestion and verified my Adobe ID on acrobat.com.
    Now I can enter the collaborate function. However, everytime when I tried to send it to myself (for test purpose) I got another error message "You need to enter a valid emaill address". I saw someone else on this forum has met the same problem. Do you have any suggestion on what is the possible reason for this to happen?
    Again, thanks for the fast response. You have been helping me and other ppl so much.

  • How to customize the error pages in iPlanet IAS 6.0?

     

    Hello ekan,
    This can be done, but you're going to need to get pretty dirty to get it done. Ready?
    First, learn about userContent.css:
    http://kb.mozillazine.org/UserContent.css
    http://kb.mozillazine.org/Profile_folder
    Now, the easiest way to learn about the elements on the error page is to go to the source. So, go to the chrome folder in the Firefox program folder, usually C:\Program Files\Mozilla Firefox\chrome in Windows Explorer. Find the file called classic.jar and copy that somewhere else. Rename classic.jar to a .zip file and extract it, preferably to a folder called classic at whatever location you are at. Then, open the classic folder and navigate to ...\classic\skin\classic\global and find the file called netError.css.
    Open the netError.css file in Wordpad (Notepad doesn't seem to work for me because then the lines all run together). See all the code that starts with the # symbol? Those are the things you can easily change. Copy all the #ELEMENT code into your userContent.css file.
    Now you can start making changes to see what you like. I would make small changes at a time to see if it works the way you want. After each change, you need to close and restart Fx. Here's one to get you going:
    CODE: SELECT ALL
    #errorPageContainer {
    -moz-border-radius: 0px !important;
    background-color: red !important;
    That should make the box that surrounds the error message be red with square corners instead of white with a rounded corner border. Remember that before every semi-colon, you need to put !important or the change won't do anything.

  • How can I display error log of a standard program in my custom program?

    Hello Experts,
    I have a requirement where I submit a standard program from my custom module pool program as a background job. I use the TO SAP-SPOOL and thus the log is available when I go to SM37 and check the spool list. I have a requirement that I display this log in a tab within my module pool after the completion of the program. I am unable to fins a proper solution to this. I have both the spool number & the log number but I am unable to find function modules which will help me print them within my program. I found many ways to display it but as full screen and not with in my program.
    Could someone please help me with this.
    Thank You

    Hi,
    FM to read a spool request is "RSPO_RETURN_ABAP_SPOOLJOB".
    If the error log is displayed as a list output in the standard program, you can also use the syntax SUBMIT Program... and RETURN with export to memory addition.
    Then you will be able to read the list output from memory.
    Regards,
    Munesh.

  • How to dynamically display images in JSPs

    This took a little while to figure out so I thought I'd share. After
              doing some research I was led to the following approach on how to load
              images from an Oracle database into a JSP:
              The "main" JSP:
              <HTML>
              <head>
              <title>Image Test</title>
              </head>
              <body>
              <center>
              hello
              <P>
              <img border=0 src="getImage.jsp?filename=2cents.GIF">
              <P>
              <img border=0 src="getImage.jsp?filename=dollar.gif">
              <P>
              world
              </body>
              </HTML>
              And this is the image getter:
              <% try {
              response.setContentType("image/gif");
              String filename = (String) request.getParameter("filename");
              java.sql.Connection conn =
              java.sql.DriverManager.getConnection("jdbc:weblogic:pool:orapool"); //
              connect to db
              java.sql.Statement stmt = conn.createStatement();
              String sql = "select image from testimage where filename = '" +
              filename + "'";
              java.sql.ResultSet rs = stmt.executeQuery(sql);
              if (rs.next()) {
              byte [] image = rs.getBytes(1);
              java.io.OutputStream os = response.getOutputStream();
              os.write(image);
              os.flush();
              os.close();
              conn.close();
              catch (Exception x) { System.out.println(x); }
              %>
              The thing to note is that there are no <%@ page import="..." %> or <%@
              page contentType="..." %> tags - just the single scriptlet. It
              seems that for every "<%@" the weblogic compiler sees it puts
              out.print("\r\n"); statements in the generated java source.(???) I
              don't know much about how browsers work but I think that once it sees
              flat ascii come at it it treats everything that follows as text/plain
              which is incorrect for the binary stream that's being sent. Another
              work around was to set out = null; but that's kind of ugly and might
              produce server errors. The real fix is to write a bean to handle images
              which I'll work on next (does anybody have any hints on how to do
              that?)
              -Erik.
              PS, thank you to the people that posted info in this group that helped
              me track down this problem. -
              

    Erik,
              No need to write a bean, just write a serverlet...
              you can use this function (however you might want to include some
              improved error handeling)
              Oh, FYI to prevent caching by the browser you might want to pass a parameter
              into the creation of the image like timeseconds or (in my case) variable
              text which
              was included into the image produced. (You need not even use the variable in
              the code, the server is not bright enough to tell)
              <IMG SRC=".....MyImageProducer?file=my.jpeg&timesecs=12345134">
              Jay L. Toops
              public boolean httpJpegStreamWriter(BufferedImage ib, HttpServletResponse
              response) {
              try {
              javax.servlet.ServletOutputStream myout = response.getOutputStream();
              byte b[] = new byte[1024];
              response.setContentType("image/jpeg");
              //File file = new File("./myserver/public_html", "testjlt.jpg");
              //FileOutputStream fos = new FileOutputStream(file);
              ByteArrayOutputStream fos = new ByteArrayOutputStream();
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
              JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(ib);
              param.setQuality(1.0f,false);
              encoder.setJPEGEncodeParam(param);
              encoder.encode(ib);
              b = fos.toByteArray();
              response.setContentLength(b.length);
              myout.write(b, 0, b.length);
              myout.flush();
              myout.close();
              } catch (Exception e) {
              System.out.println("MY httpJpegStreamWriter Exception\n is :"+
              e.toString());
              return(false);
              return(true);
              Erik Lindquist wrote:
              > This took a little while to figure out so I thought I'd share. After
              > doing some research I was led to the following approach on how to load
              > images from an Oracle database into a JSP:
              >
              > The "main" JSP:
              >
              > <HTML>
              > <head>
              > <title>Image Test</title>
              > </head>
              > <body>
              > <center>
              > hello
              > <P>
              > <img border=0 src="getImage.jsp?filename=2cents.GIF">
              > <P>
              > <img border=0 src="getImage.jsp?filename=dollar.gif">
              > <P>
              > world
              > </body>
              > </HTML>
              >
              > And this is the image getter:
              >
              > <% try {
              > response.setContentType("image/gif");
              > String filename = (String) request.getParameter("filename");
              > java.sql.Connection conn =
              > java.sql.DriverManager.getConnection("jdbc:weblogic:pool:orapool"); //
              > connect to db
              > java.sql.Statement stmt = conn.createStatement();
              > String sql = "select image from testimage where filename = '" +
              > filename + "'";
              > java.sql.ResultSet rs = stmt.executeQuery(sql);
              > if (rs.next()) {
              > byte [] image = rs.getBytes(1);
              > java.io.OutputStream os = response.getOutputStream();
              > os.write(image);
              > os.flush();
              > os.close();
              > }
              > conn.close();
              > }
              > catch (Exception x) { System.out.println(x); }
              > %>
              >
              > The thing to note is that there are no <%@ page import="..." %> or <%@
              > page contentType="..." %> tags - just the single scriptlet. It
              > seems that for every "<%@" the weblogic compiler sees it puts
              > out.print("\r\n"); statements in the generated java source.(???) I
              > don't know much about how browsers work but I think that once it sees
              > flat ascii come at it it treats everything that follows as text/plain
              > which is incorrect for the binary stream that's being sent. Another
              > work around was to set out = null; but that's kind of ugly and might
              > produce server errors. The real fix is to write a bean to handle images
              > which I'll work on next (does anybody have any hints on how to do
              > that?)
              >
              > -Erik.
              >
              > PS, thank you to the people that posted info in this group that helped
              > me track down this problem. -
              

Maybe you are looking for

  • Audio tracks missing in the timeline viewer

    Hello, I am using Imovie 4.0.1 and have been working on a project for several months and now towards the homestretch, I have lost the ability to see the audio tracks that I added to the project. I am referring to the 2nd and 3rd tracks on the timelin

  • Creating Dashboard Widgets

    Ok, I'm trying to create my first Dashboard widget; and I need some help. Heres my Info.plist: <plist> <dict> <key>CFBundleIdentifier</key> <string>com.JZ.widget.Mailer</string> <key>MainHTML</key> <string>index.html</string> </dict> </plist> Heres m

  • Namespaces in TransformerHandler?

    Are SAX namespace events correctly handled by javax.transformer.sax.TransformerHandler? Given the following class: import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.str

  • Adobe reader installation

    I am trying to re-install adobe reader x after uninstalling from control panel in windows 7. But the setup fails stating that there is a more functional product already installed.

  • How to distinguish backing bean method invoker like struts *.do

    I want to monitor request and response time of application via access log of httpd . But the urls are the same in one backing bean. how should i do about this?