Results 1 to 3 of 3
  1. #1
    Fooch is offline Member
    Join Date
    Aug 2011
    Rep Power

    Default JSP/JSF and object paths

    This is going to be a really stupid question but I have had this issue forever and I can never figure it out and I don't know if I am just missing some basic thing or something, so I apologize upfront.

    I am pretty proficient in java and have been doing it for a while and I am somewhat of a novice when it comes to UIs, i.e. JSP, JSF, IceFaces, Zk, etc. I am constantly having an issue when I am trying to reference objects from a ,jsp/jsf page. Like linking to a style sheet or an image. I can never figure out the path to the object. I try the path that it is in in my project in eclipse, I try the path it is in from the page in the WAR, and I try to drag the object into the source of the jsp(eclipse) and it puts a path in there, NOTHING works. I always end up having to throw the images and style sheets in the same path as the page and referencing just the name of the file.

    Java Code:
             <link href="/WEB-INF/classes/styles.css" rel="stylesheet" type="text/css"/>
                <h:outputText value="#{msgs.windowTitle}"/>
    This is an extremely basic project just to test this. I am attaching a quick screen shot so you can see where they are in relationship to themselves. Also the href is /WEB-INF/classes/style.css because that is where it lies from the index.jsp in the war. If anyone can help me understand how to determine the paths or point me in the right direction would be greatly appreciated.

    JSP/JSF and object paths-issue.jpg

  2. #2
    Fooch is offline Member
    Join Date
    Aug 2011
    Rep Power


    Can anyone tell me what I'm doing wrong?

  3. #3
    nicephotog is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default Re: JSP/JSF and object paths

    /WEB-INF/classes is not an http or web directory , its part of the "J2EE container(java server)" specification.
    both WEB-INF and classes are purely for the benefit of java servers regardless individualised applications in .war files(folders).
    .css on the other hand is a totally web w3c specification in all web site disc zones and really is for the purpose of rendering html and xml. .css has nothing related to java server container structure excepting to know it should be referenced from an area of a java application the is in

    In the jakarta tomcat site they do show methods of referencing CSS style sheets in such places and transparently, but it is bad practice because it does not actually belong to(is irrelevent) java server container structure , only web markup xml and html specifications.

Similar Threads

  1. Paths And Such
    By han003 in forum New To Java
    Replies: 6
    Last Post: 03-25-2011, 09:58 AM
  2. Paths
    By N00Bie in forum New To Java
    Replies: 5
    Last Post: 02-23-2011, 12:48 AM
  3. Paths in different os's
    By hardcorebadger in forum New To Java
    Replies: 7
    Last Post: 01-28-2011, 07:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts