5 Replies Latest reply on Feb 15, 2007 4:53 PM by Saeed Iqbal

    Tip worthy of inclusion in the documentation...

    Tony Herstell Master

      Can this be added to the doco.. it's a great tip.

      perhaps close to pg 67

      The <factory> declaration lets you specify a value or method binding expression that will be evaluated to initialize
      the value of a context variable when it is first referenced.
      <factory name="contact" method="#{contactManager.loadContact}" scope="CONVERSATION"/>

      I also use the following in components.xml
      <factory name="basePath"

      Note this is all one line the forum wrapped


      <base href="#{basePath}" />

      So i can have the view files in different directories, but still resolve the images and css to the root of the webapp with out having to do ../../images/myimage.jpg

      I used to use something like this

       public void setup() {
       request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
       public void loadBasePath()
       basePath = request.getScheme() + "://" +
       request.getServerName() + ":" +
       request.getServerPort() + request.getContextPath() + "/";

      Thank you for your time,

      Jason Long
      CEO and Chief Software Engineer
      BS Physics, MS Chemical Engineering
      HJBUG Founder and President

      led to me re-organising my code a lot:
      <link rel="stylesheet" type="text/css" ref="#{basePath}/xmlhttp/css/xp/xp.css" />
      <link rel="stylesheet" type="text/css" href="#{basePath}/css/risingstars.css" />

      Allowing me to move a lot of pages that users should not access under WEB-INF


      Perhaps it obvious to you lot, but saved me a whole heap of headache.