-
1. Re: How to avoid a 404 error in a <s:graphicImage>?
danielc.roth Nov 28, 2008 7:36 PM (in response to geziefer)You could try something like:
<s:graphicImage value="#{testAction.photo}" rendered="#{testAction.photo != null}"/> <h:graphicImage value="/path/to/noimage.jpg" rendered="#{testAction.photo == null}"/>
-
2. Re: How to avoid a 404 error in a <s:graphicImage>?
geziefer Dec 1, 2008 2:23 PM (in response to geziefer)Thanks for your answer - but unfortunately it won't work that way, because what I get back from the action method is an URL which is build from a stored path from the database and which is not null but points to a non-existing location.
So what I need is either a tag which won't give me a 404 if the URL of the image is not accessible or a cheap technique to check for an accessible URL without the need of loading the content.
Alex -
3. Re: How to avoid a 404 error in a <s:graphicImage>?
francof Dec 1, 2008 6:04 PM (in response to geziefer)I did something like this a long time ago. I can't find that code, but you have to use java.net.URL to check your image url, it throws an exception if the resource does not exist.
Regards
Franco -
4. Re: How to avoid a 404 error in a <s:graphicImage>?
geziefer Dec 2, 2008 1:13 PM (in response to geziefer)So you are saying, I should use a method on the retrieved URL to provoke an IOException if not accessible to replace it then by a default URL?
I thought openConnection() would be enough to do, but it seems, that only if I add openStream() it works that way.
And do you think, this is a sensible way to deal with the problem - sensible in terms of persormance? -
5. Re: How to avoid a 404 error in a <s:graphicImage>?
geziefer Dec 9, 2008 2:47 PM (in response to geziefer)Hi all again
I have to come back to this discussion - unfortunately the solution is not acceptable, because if for example the server on which all the images in the list are located is not available and thus all the URLs in the list point to a non-accessible ressource, it takes a long time to display the page, I guess due to a timeout for each test.
So, the question would be, why is a 404 error generated and how can I avoid that and display something else instead?
Alex