Displaying default image on page load if actual image is not retrieved

Hello All,
In jsff i have something like below
<af:image source="path/something.jpg" id="id_1" styleClass="displayingImage">
but if the image is not present in the path then a red cross is displayed.
Is there any way where i can display a default image on page load if image is not properly loaded.

Approach 1
If i bind "source" property to back bean and check it will work.
But because of the complexity of project, it is not possible to go with this approach.
Approach 2 (I am selecting this approach)
(Working fine)
When i click on image, the image is set to as default image
<af:resource type="javascript">
var changeImage = function (event) {
    $('.cssclass').each(function(){
        var image = $(this);
        $(image).hover(function(){ 
                $(image).attr('src','/path/defaultImage.png');
</af:resource>
<af:image source="http://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}/file/#{pageFlowScope.bean.imageName}&amp;Rendition=164FixedWidth" id="id_1" styleClass="cssclass"
              rendered="#{!empty pageFlowScope.bean.imageName}">
     <af:clientListener method="changeImage" type="click" />
</af:image>
(Not Working fine)
On page load
<af:resource type="javascript">
$(document).ready(function(){                        //on page load
      alert("Check");                                         //alert is displayed correctly
      $('.cssclass').each(function(){                         //search for all image with name "cssclass"
          var image = $(this);
          $(image).load(function(){}).error(function(){       //JQuery experts, can you please tell me if this line works in ADF
              $(image).attr('src','/path/defaultImage.png');
</af:resource>
<af:image source="http://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}/file/#{pageFlowScope.bean.imageName}&amp;Rendition=164FixedWidth" id="id_1" styleClass="cssclass"
              rendered="#{!empty pageFlowScope.bean.imageName}">
</af:image>
<af:image source="http://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}/file/#{pageFlowScope.bean.imageName}&amp;Rendition=164FixedWidth" id="id_2" styleClass="cssclass"
              rendered="#{!empty pageFloScope.bean.imageName}">
</af:image>

Similar Messages

  • CSS on some pages is not displaying properly on initial page load.

    I'm running into an issue where a page loads and the styles do not render correctly. After the page loads, I can temporarily fix this by choosing: View->Page Style->No Style, then doing it again with: View->Page Style->Basic Page Style. Though when navigating away from the page and then coming back to it, I will have to do it over again.
    I'm experiencing this issue on v. 36.0.3 for Windows and v. 36.0 for Ubuntu

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    You can check the Net log and the Network log in the Web Console (Firefox/Tools > Web Developer) to see how long it takes for content to arrive.
    *https://developer.mozilla.org/Tools/Network_Monitor
    You can also try to reset (power on/off) the router and maybe check with your ISP if it happens on more than one OS.

  • Safari 2.0.3 - Pages load with no images or some images

    Hi
    I just bought a new iMac Intel. It comes with safari 2.0.3
    Any page on the web loads without the images. In place of the image is a ? icon.
    If I hit the reload button a few times, the images load up. Sometimes even after a dew reloads, some images are still not loaded.
    Any idea why this is happening?
    Thanks in advance for any assistance.

    I have not changed any of the Quicktime settings yet.
    Since posting I have installed Firefox. Firefox loads the page www.apple.com flawlessly.
    If you would like me to check any of the quicktime settings, can you give me more details on how to do this?
    Thanks for your advice

  • Images some old loading new imported images not showing

    I am working with cs4 /windows.  I can not get new images to show.  When designing the page and importing the images it shows. When "putting" publishing it does not show.
    The only thing I could see as a problem would be old (very) server?.
    I left some images that were on the server to begin with and they show up. The newly added images do not.
    http://www.twinsburgtravel.com/sandals-resorts.html

    checking into that... I am thinking it is the server being old and not being able to handle space and new images.
    thanks! will get back to you on this later this afternoon.

  • Ramdon image on page load

    Hi does anyone know a simple method of changing an image when
    a page is reloaded or refreshed?

    ASP?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "DLoe" <[email protected]> wrote in message
    news:eb0pbi$5jh$[email protected]..
    > ASP and most Windows servers have the AdRotator
    component loaded, and you
    > can use that. If, however, you use PHP or Unix, that's
    not a solution.

  • Image caching. Loading only new images

    we develop huge game and it takes some time to load on startup because of tons of assets. Once per week or 2 weeks it is updated to new version which might bring few new assets or update previous ones.
    So now we are trying to find the way that will allow flash to load only new/updated assets and the rest to fetch from cache. But we haven't succeeded yet. Does anybody have any idea?

    thanks for the responce. Unfortunatelly, my English is not perfect. You mean sending to flash (flashvars) a variable containing a set of images to load so those ones that are not in the list are to be taken from cache?

  • Web View / Play on Page load...

    I have experienced an issue with the play on page load option within DPS. When embedding multiple html5 animations within one file the play on page load makes all animations start at the same time. By the time the reader has read the copy and lets say comes to page two or three the animation on that page has already played. If I now don't want to loop the animation it means all the fun is over when I come to the page.
    Anyone experienced similar problems?
    Solutions?
    Thank you,
    Alex

    Yes, I've noticed the same issue. With some Web Content overlays, the play on page load option actually means "play on article load." This happens with the Overlays > Web Content article in the DPS Tips app. There is a local HTML animation on page 3 of that article that launches when you first turn to the article. I'll ask around and let you know what I find out.

  • Is this page loading OK for you

    Hi all
    I am experiencing an issue with my wordpress blog (hosted
    with HostMySite) -
    no major changes except the insallation of a well known SEO
    plugin (but
    worked fine after that installation).
    HMS says everything is OK at there end, but.
    When I try to load the site I am getting intermittant
    problems such as:
    DNS server errors
    Page loads without the CSS
    Page loads with missing images.
    Wordpress admin pages not loading correctly or not loading at
    all
    Site has been fine for ages.
    Could you see if the following pages loads for you and any
    other pages from
    the links (thanks)
    http://www.visit-the-coqui.com/2008/01/first-ever-pga-tour-in-puerto-rico/
    If it is not HMS, what other reasons can there be for
    internittantly loading
    a page with no css or missing images (note css files and
    images are all
    loaded on the server)
    Thanks

    I'm not in India.....
    Puerto Rico, Caribbean, blue skies and sun (although it's
    cloudy today).
    It is running a bit slow though
    "Pablo" <[email protected]> wrote in message
    news:[email protected]...
    > Yes it can, it happens to me sometimes. I'm in Menorca
    but B is in India
    > :)
    >
    >
    http://news.bbc.co.uk/1/hi/technology/7222536.stm
    >
    > --
    > Kind Regards
    >
    > Paul Dell
    > .................................
    > An Eye of Menorca
    > www.dellimages.com
    > .................................
    > Blog
    > www.paul-dell.com
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:[email protected]...
    >>I don't think so.
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >> ==================
    >>
    >>
    >> "B" <[email protected]> wrote in message
    >> news:[email protected]...
    >>> Thanks
    >>>
    >>> Would an issue with my internet connection cause
    a page to load without
    >>> css and images?
    >>>
    >>> Thanks
    >>>
    >>>
    >>> "Pablo" <[email protected]> wrote
    in message
    >>> news:[email protected]...
    >>>> Loads fine for me, winXP ff2
    >>>>
    >>>> --
    >>>> Kind Regards
    >>>>
    >>>> Paul Dell
    >>>> .................................
    >>>> An Eye of Menorca
    >>>> www.dellimages.com
    >>>> .................................
    >>>> Blog
    >>>> www.paul-dell.com
    >>>> "B" <[email protected]> wrote in message
    >>>> news:[email protected]...
    >>>>> Hi all
    >>>>>
    >>>>> I am experiencing an issue with my
    wordpress blog (hosted with
    >>>>> HostMySite) - no major changes except
    the insallation of a well known
    >>>>> SEO plugin (but worked fine after that
    installation).
    >>>>>
    >>>>> HMS says everything is OK at there end,
    but.
    >>>>>
    >>>>> When I try to load the site I am getting
    intermittant problems such
    >>>>> as:
    >>>>>
    >>>>> DNS server errors
    >>>>>
    >>>>> Page loads without the CSS
    >>>>>
    >>>>> Page loads with missing images.
    >>>>>
    >>>>> Wordpress admin pages not loading
    correctly or not loading at all
    >>>>>
    >>>>> Site has been fine for ages.
    >>>>>
    >>>>> Could you see if the following pages
    loads for you and any other pages
    >>>>> from the links (thanks)
    >>>>>
    >>>>>
    http://www.visit-the-coqui.com/2008/01/first-ever-pga-tour-in-puerto-rico/
    >>>>>
    >>>>> If it is not HMS, what other reasons can
    there be for internittantly
    >>>>> loading a page with no css or missing
    images (note css files and
    >>>>> images are all loaded on the server)
    >>>>>
    >>>>> Thanks
    >>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >
    >

  • Start page loads instead of homepage

    I am using firefox ESR v17.0.8 on Windows 7 with the firefox.adm policy template to customize some of my browser settings. I have specified a homepage to load on startup but whenever I start firefox the default firefox start page loads instead.
    If I click the home button the correct page loads and if I look under Tools/Options/General it is set to load my home page and the correct home page URL is specified.
    I have tried starting without any addins loaded but it doesn't make a difference. Suggestions?

    Try the following:
    1) Go to '''about:config''' (type it in the adress bar).
    2) Enter.
    3) Search for '''browser.startup.homepage'''.
    4) This variable controls what page is loaded when you start Firefox.
    According to your post its value should be '''about:home'''. Change this value to the website you'd like to load on start.
    To change what website it opens when you open a new tab, do the same but with '''browser.newtab.url'''.

  • Populate LOV on page load

    Hi,
    I have a requirement that when the OA page is first time invoked, there is an Account ID request parameter that will be passed. I need to set the Id in LOV so that it will display the value on page load.
    Example: AccountID=123 is passed as request param. Then LOV should display "Account123" on page load. Account123 is display value and 123 is key value.
    Thanks,
    Bhavnesh.
    Edited by: bhavnesh_p on Feb 25, 2009 3:49 PM

    Hi
    u can do in this way in processRequest method
    String Account_ID =(String) pageContext.getParameter("Account ID ");
    OAMessageLOVInputBean mtiBean = (OAMessageTextInputBean)table.findIndexedChildRecursive("LovField_ID");
    mtiBean.setText( pageContext,Account_ID );
    Thanx
    Pratap

  • Slow web page loading in Safari with DSL

    I've got an intermittent problem which may not be Safari-related, but I need to ask it anyway because Mac friends of mine have experienced similar problems.
    I just changed my ISP from satellite interenet to mid-speed DSL. Ever since the changeover, I've found that more often than not, pages seem to load about 66%, then data reception seems to stop. When pages DO load, they load quickly, but most of the time, pages seem to stop loading at a certain point. If I hit refresh (often after several times), then the page loads as fast as lightning.
    Could there be something with Safari that interacts with the DSL connection which causes the loading to stall? Many times, pages don't load at all, and I'm wasting time waiting for pages to "just pop up", Other times, I will get "Page Not Found" even though I KNOW there's a page existing at that particular location, yet Safari doesn't display it unless I first hit "Refresh". Still other times, The same pages load just fine, whether or not I empty the cache and close the downloads window.
    Any ideas, people?
    Jim Barg
    Power Mac G5 Dual 2.0GHz   Mac OS X (10.4.3)   What other computer?

    Hi Jim,
    The 'refresh to force the page to load' symptom is usually a sign that you either have the wrong DNS addresses specified in your Network preferences or your ISPs DNS server are very slow.
    Have a search for DNS on the Safari forum - there's quite a few posts and sample addresses for you to try out.
    Good luck.

  • Named Criteria for Table Not Filtering on Page Load

    Hi Guys and Gals,
    I'm tying to create a filtered table using named view criteria (http://docs.oracle.com/cd/E24382_01/web.1112/e16182/web_search_bc.htm#BABBCHIH).
    I create the Named Criteria; I drag from the Named Criteria from the Data Control onto the page; I select ADF Read-Only Filtered Table option. I run the page and much to my chagrin, the table is not filtered. A table with all results, plus a filter box with a value "S" (my named criteria filter value), is displayed.
    Shouldn't the results already be filtered upon page load?
    The filter works correctly when I run tests in my AppModule.
    Using JDev 11.1.2.1.0.
    Will

    I've found a workaround.
    I drag and drop the VO (unfiltered) from the Data Control and select read-only table. In my pageDef, I select the table's binding and check the "Enable Filtering" box. I then select the attribute to filter on and the applicable filter text.
    The table then displays filtered results on page load.
    However, I only see this working for very simple filtering (i.e. one column with simple filter requirements). It should be nice to know why dragging and dropping Named View Criteria onto the page does not automatically filter table results on page load.
    Will

  • Firefox for Android slower, on page loading, than desktop version on the same hardware?

    I did test Firefox for linux paralel to the Android version on the same tablet, in the exact same time.
    Mobile version: 22.0 - Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0
    Desktop version: 11.0 - Mozilla/5.0 (X11; Ubuntu; Linux; armv7l; rev:11.0) Geko/20100101 Firefox/11.0
    Mobile version starts, indeed, faster (2-3s vs 7-10s) but page loading looks like it's being strangled by something.
    Unlike desktop version, which, with it's rendering issues - I'm running it on top of an X11 framebuffer,
    the mobile version can take up to 2 minutes to load a webpage like plus.google.com.
    The Desktop version, running on the same tablet and taking cpu time along Android, takes less than one minute. I'm convinced it would be 2-3x faster running alone and even faster if the gpu would do the rendering.
    On other pages the difference is even more striking...
    And it‘s obviousv that it is not a rendering issue but a data transfer bottleneck.
    Any idea on closing the gap on page loading times between the two, not involving slowing down the desktop version? :)
    My hardware specs: Allview branded ly-f1 tablet, 1GHz Cortex A8, 1Gb DDR3 RAM, 8Gb internal nand flash
    Android 4.1.1 and Ubuntu 12.04 lts compiled with hardfloat for armv7.
    My internet connection being a 50Mb/s optical routed to a 802.11n 150Mb/s wifi router.
    I would love to switch to Ubuntu only but I cant do that yet... Mali400 and cedarX still puzzle me and fellow linux geeks...

    see: [[Firefox for mobile is slow - How to make it faster|Firefox for mobile is slow - How to make it faster]]

  • Resizing 1) background images and 2) div's containing images

    I just created a web page consisting of little more than an image (about 900 pixels) wide which is set at width=100% in a style sheet. It works great, but I'd like to substitute a smaller image (to reduce page loading time) in mobile devices.
    If it was a background image, I could just declare two different background images based on screen size, but I don't know of any way to swap between images actually inserted in a page.
    So, is it possible to give a background image a width in percentage, similar to a static image? In other words, if my screen was 651 pixels wide, then a static image inside a container spanning the entire screen should also be 651 pixels wide. Can I rig it so that a background image in that container would also be 651 pixels wide?
    Of course, the obvious problem is height. If a background image measures 900 X 1200 pixels, and a screen is 600 pixels wide, then even if there's a style that makes the image 600 pixels wide, it would also have to calculate a height of 800 pixels, and I'm guessing that can't be done.
    Anyway, I'd just like to know what kinds of tricks one can use in making background images and divs containing static images display in percentages based on screen size.
    Thanks.

    Use background-size:cover; for your background images.
    Further reading: http://css-tricks.com/perfect-full-page-background-image/
    EDIT:// For swapping out placed images, it's a little harder to do right now as there is no specified solution from W3C. Some people want to use the srcset attribute, others the <picture> tag. There is no perfect approach right now. See: http://mobile.smashingmagazine.com/2013/08/21/webkit-implements-srcset-and-why-its-a-good- thing/
    One idea is you could hide the image and then load a background-image in the container which is smaller in size. But this would likely bloat your HTML and CSS as you use multiple images - the device will also load both images so you don't gain any real advantage unless you intend to show a croppoed or different image.
    Other ideas: http://mobile.smashingmagazine.com/2013/07/08/choosing-a-responsive-image-solution/
    <div class="image">
         <img src="YourImage.jpg" alt="" width="500" height="250" />
    </div>
    @media only screen and (max-width: 480px) {
         .image img {display:none;}
         .image {
              background:url("YourImage_Mobile.jpg") no-repeat 0 0;
              background-size:cover;
    Another idea is to show/hide the relevant image:
    <img src="YourImage.jpg" alt="" width="500" height="250" class="desktop" />
    <img src="YourImage_mobile.jpg" alt="" width="300" height="180" class="mobile" />
    @media only screen and (max-width: 480px) {
         .desktop {display:none;}
         .mobile {display:block;}

  • Safari won't display a site correctly, sometimes page takes extended time to respond and partially loads other times images wont load

    So I have a friend who I've been trying to assist with this. I don't know if she has issues with other sites or she may not have encountered any yet, but one in particular is just not working. It started about a month ago around the time she moved (so different ISP/router etc.) though not entirely sure if it started right after that or if it was just coincidence. Anyways she cleared cookies/cache, no luck. I had her update and restart the computer, still not working. Disabled all extensions, still doesn't work. It can take upwards of 30-45 seconds to even respond in some cases, and when it does sometimes the page is all white with just text improperly formatted, but the background doesn't display at all, other times the background images and text are displaying correctly but the nearly all the user submitted images on the site (deviantart) will not display. I believe she mentioned it occasionally happened on tumblr as well.
    Other computers on her network are fine. I downloaded Firefox to see if it was a problem that persisted across browsers and indeed it did. So I went into the console on Firefox and looked at further information and it was returning Status Code 304 Not Modified which I looked up and that says it is telling the browser that the images should be loaded from cache. Problem with that is she shouldn't have any cache as its been cleared. I searched around this issue, found a suggestion saying to clear DNS cache, tried that and suddenly Firefox worked. I then logged into her username on DeviantArt through Firefox and suddenly the issues returned. I eventually was able to log out and things worked again. Now when I log into her account through Firefox it works fine. Safari still has issues.
    I've even deleted the cache.db file in the library/safari folder and quit/restarted Safari and still no success. I've tried disabling cache through the developer options. The status code 304 error made me believe that the reason the images weren't showing up is because there is no cache for those images but the server is telling the browser to use the cache so the images cannot load. One last thing I can mention is that on the console in Safari, it often just returns many errors for all the images on the site saying it didn't respond. One time there were errors saying something about the security certificate but I refreshed numerous times after that and that error never showed up again in the console. Anyone know what might be causing this?

    Hi ...
    Start here >  Safari 5.0.1 or later: Slow or partial webpage loading, or webpage cannot be found
    If nothing helped from that link, try troubleshooting Safari plug-ins.
    From the Safari menu bar click Safai > Preferences then the Security tab. Deselect:  Allow all other plug-ins. Quit and relaunch Safari to test.
    If that made a difference, instructions for troubleshooting plugins here.

Maybe you are looking for