0 Replies Latest reply on May 28, 2008 10:51 PM by Gordon DuQuesnay

    c:set bean as a variable to be referenced in facelet tag

    Gordon DuQuesnay Newbie

      I have 40 pages that make numerous references to their respective backing beans.

      I have created custom facelet tags for the label/input fields on these pages.

      They look something like this now:

            <my:inputText label="Service Number (existing)" bean="#{HomeFoneNameChange}"   property="serviceNumberexisting"  />      
            <my:selectOneMenu label="Title" bean="#{HomeFoneNameChange}"  selectItems="#{titleSelectItems}" property="title"  />      
            <my:inputText label="Surname" bean="#{HomeFoneNameChange}"   property="surname"  />      
            <my:inputText label="First Name" bean="#{HomeFoneNameChange}"   property="firstName"  />      
            <my:inputDate label="Date of Birth" bean="#{HomeFoneNameChange}"   property="dateofBirth"  />      
            <my:selectOneMenu label="Sex" bean="#{HomeFoneNameChange}"  selectItems="#{sexSelectItems}" property="sex"  />      
            <my:inputText label="Alternate Contact Number" bean="#{HomeFoneNameChange}"   property="alternateContactNumber"  />      
            <my:textArea label="Customer Billing Address" bean="#{HomeFoneNameChange}"   property="customerBillingAddress"  />      
            <my:checkbox label="Directory Listing (Y/N)" bean="#{HomeFoneNameChange}"   property="directoryListingYN"  />      
            <my:inputText label="Reference Name" bean="#{HomeFoneNameChange}"   property="referenceName"  />      
            <my:inputText label="Employer Telephone Number" bean="#{HomeFoneNameChange}"   property="employerTelephoneNumber" required="false" />      
            <my:checkbox label="Authorization Letter Presented" bean="#{HomeFoneNameChange}"   property="authorizationLetterPresented"  />      
            <my:textArea label="Special Instructions" bean="#{HomeFoneNameChange}"   property="specialInstructions" required="false" />      
             <my:sectionEditableByInternalOnly bean="#{HomeFoneNameChange}" />
              <my:buttonGroup bean="#{HomeFoneNameChange}" />

      Notice the repetition of the bean name.  I'd like to know if it's possible to set the bean name once per page

      something like:

      <c:set var="bean" value="#{HomeFoneNameChange}" />

      and then just refer to it like this:

         <my:inputText label="Service Number (existing)" bean="${bean}" property="serviceNumberexisting"  />  

      needless to say this hasn't been working for me, attempting the above results in:

      /WEB-INF/facelets/selectOneMenu.xhtml @22,120 value="#{bean[property]}": Target Unreachable, identifier 'bean' resolved to null