3 Replies Latest reply on Aug 24, 2010 1:55 AM by Michael Abele

    How to apply different style for single output text field?

    Eswara MoorthyNEC Newbie

      Hi, everyone,

       

      I want to apply different style for output text value.

       

      Here i get the outputtext value from bean class during form initialization.

      The outputText value is :  Name ?

       

      I want hightlight the symbol like apply Red color (Ex:    Name ?   here inputBox )

       

      Is possible css  apply to that symbol?

       

       

      Style.jsp   
                

      <h:form id="styleForm" binding="#{Style.initForm}">                
         <h:panelGrid columns="2">
      
            <h:outputText  value="#{Style.name}  #{Style.specialSymbol}"/>                                                 
      
            <h:inputText value=""/>
        </h:panelGrid>                                  
      </h:form>
      

       

       

      Style.java


        

      package style;
      
      import javax.faces.component.html.HtmlForm;
      
      public class Style
      {
      
          private HtmlForm initForm;
          private String name;
          private String specialSymbol;
          
          public HtmlForm getInitForm()
          {
              name = "Name ";
              specialSymbol = " ? ";
              return initForm;
          }
          
          public void setInitForm(HtmlForm initForm)
          {
              this.initForm = initForm;
          }   
          public String getName()
          {
              return name;
          }    
          public void setName(String Name)
          {
              this.name = Name;
          }    
          public String getSpecialSymbol()
          {
              return specialSymbol;
          }    
          public void setSpecialSymbol(String specialSymbol)
          {
              this.specialSymbol = specialSymbol;
          }
      }
      

       

      faces-config.xml

       

      <managed-bean>
              <managed-bean-name>Style</managed-bean-name>
              <managed-bean-class>style.Style</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
          </managed-bean>
      

       

       

      Help me about this.

      Thanks in advance.