-
1. Re: Images not shown at first page invocation
ilya_shaikovsky Jul 6, 2009 5:45 AM (in response to nschweig)use
<h:graphicImage value="#{facesContext.externalContext.requestContextPath}/img/buttons/edit.png"/>
instead of your relative src's. -
2. Re: Images not shown at first page invocation
user1234 Jul 6, 2009 6:04 AM (in response to nschweig)In my application i am also using facelets and richfaces, my images are kept inside webcontent in "images" folder and i can accessing it by relative path like \images ..here is the snap....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <head> <ui:insert name="pageHead"> </ui:insert> </head> <f:loadBundle basename="language/rsw_en" var="res" /> <f:view contentType="text/html" > <body id="bodycontainer" onload="setOnLoadFlag()" > <h:form id="PageForm" > <a4j:outputPanel id="statusPanel" ajaxRendered="true" > <a4j:status id="commonstatus" onstart="startProgress()" onstop="stopProgress()" /> <h:graphicImage id="statusImage" value="/images/busystatus.gif" style="visibility:hidden" styleClass="statusImageStyle" /> </a4j:outputPanel> <div id="pageMenuBar"> <ui:insert name="menuBar"> </ui:insert> </div> <div id="pageBody" style="padding-left: 3px;"> <ui:insert name="pageBody"> </ui:insert> </div> </h:form> </body> </f:view> </html>
-
3. Re: Images not shown at first page invocation
nschweig Jul 6, 2009 10:53 AM (in response to nschweig)Hi,
I have got the same problem as user1234.
My images-folder ist in the web-content folder of my application.
My application-folder with the pages, too.
Web-Content
- application
- -
4. Re: Images not shown at first page invocation
nschweig Jul 6, 2009 10:54 AM (in response to nschweig)Hi,
I have got the same problem as user1234.
My images-folder ist in the web-content folder of my application.
My application-folder with the pages, too.
Web-Content
- application
- ....xhtml
- img
- .....png
Where does the img folder has to be?
Thank you,
NSchweig -
5. Re: Images not shown at first page invocation
nbelaevski Jul 6, 2009 2:40 PM (in response to nschweig)The problem with relative images is that JSF actions by default use forwarding, i.e. do not change the path by which the page is known to the browser. Possible solutions are usage of redirect or absolute image paths.
-
6. Re: Images not shown at first page invocation
nschweig Jul 8, 2009 3:32 AM (in response to nschweig)Hi,
i have got a solution.
It is possible to set the root direction with the base tag (in the head-tag in the basic-template from your facelets-pages)<base href="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.requestContextPath}/"/>
That makes sense if you have a directory structure like
application
- pages
- img
- css
Thank your for answers.
NSchweig -
7. Re: Images not shown at first page invocation
ilya_shaikovsky Jul 9, 2009 7:18 AM (in response to nschweig)be careful with this if planning to use rich:editor component.