1

I'm working on a JSF 2.0, Spring 3.1.1 Projekt. I've an old commons-resource-jar created for Spring 3.1.1 MVC with the following structure:

commons.jar
  • --- img
    • --- myLogo.png
  • --- css
    • --- myStyle.css
  • --- js
    • --- myScript.js
      ..

Unfortunately this is not the structure a JSF 2.0 ResourceHandler is handling this correctly. As defined by JSF 2.0 the folder Structure should be

commons.jar
  • --- META-INF
    • --- img
      + --- myLogo.png
    • --- css
      ...

How can I configure my JSF 2.0 ResourceHandler so it can handle my initial folder structure from the old resource-library?

dog0584
  • 11
  • 4
  • possible duplicate of [how to share a jsf error page between multiple wars](http://stackoverflow.com/questions/5379995/how-to-share-a-jsf-error-page-between-multiple-wars) – BalusC Oct 12 '12 at 10:12
  • I have a custom ResourceResolver, but this is not reacting on img or css files, just on xhtml files. Any Ideas? – dog0584 Oct 16 '12 at 08:43
  • They need to be referenced by ``, ``, etc. – BalusC Oct 16 '12 at 10:02

2 Answers2

0

get the running application instance and get the resource handler class and modify it may be one way.

javax.faces.application.ResourceHandler

nicephotog
  • 19
  • 1
0

If you're using the Facelets technology (which is propably the case with JSF 2.0) you may want to use a custom resource resolver. Check out this answer about how to load resources from outside the default structure.

Community
  • 1
  • 1
Alexander Rühl
  • 6,769
  • 9
  • 53
  • 96
  • 1
    I'm currently using a custom resource resolver, configured in the web.xml.
    facelets.RESOURCE_RESOLVER
    com.mycompany.facelets.resource.ClasspathResourceResolver

    But it just resolves *.xhtml and no *.jpg, *.css, ...
    Any ideas why?
    – dog0584 Oct 15 '12 at 07:56
  • I think the solution will be a custom in the faces-config. Does anybody know if there is an existing custom implementation which is able to handle the above described folder-structure. – dog0584 Oct 15 '12 at 09:41