1 Reply Latest reply on Nov 3, 2008 3:10 PM by Guillaume Jeudy

    Injecting non-components

    John Ament Master

      Hey, so I'm wondering if anyone could explain something further on this topic.

      I have a page parameter, defined like this in pages.xml

         <page view-id="/blog/viewBlog.xhtml">
                   <param name="smartName" value="#{viewBlog.smartName}" />

      and I have a class defined like this (standard javabean component)
      public class ViewBlog

      All's well and good when ViewBlog has a getter and a setter for smartName.  However, I'm wondering if there's someway I could define a component for this property, or make a generic scoped object, something like this (how I grab the user's IP addrss)

      <factory name="remoteAddr" value="#{facesContext.externalContext.request.remoteAddr}"/>

      And then reference it like this (btw, smartName's defined as @In String smartName)
      @In("#{remoteAddr}") private String ipAddress