myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cagatay Civici" <cagatay.civ...@gmail.com>
Subject Re: binding property in my custom tag is not working
Date Fri, 23 Nov 2007 08:50:37 GMT
Try removing anything related to binding in your custom tag, since it
extends HtmlPanelGridTag which eventually extends UIComponentTag, binding
property should be taken caren of in super class.

On Nov 23, 2007 9:04 AM, Rajeshekar S <rajeshekar.j2ee@gmail.com> wrote:

> Hi ,
>         I want to create a custom tag with binding attribute.In the
> customTagClass i put  property binding .
> The Tag class is:
> public class CustomPanelGridTag extends HtmlPanelGridTag{
>         private String paginator;
>         private String binding;
>
>
>   public void setBinding(String binding) {
>    this.binding = binding;
>   }
>
>   public void setPaginator(String paginator) {
>    this.paginator = paginator;
>   }
>
>  public String getComponentType() {
>          return CustomPanelGrid.COMPONENT_TYPE;
>      }
>
>     public String getRendererType()
>     {
>         return "javax.faces.Grid";
>     }
>      protected void setProperties(UIComponent component) {
>          super.setProperties(component);
>       setString(component,"paginator",paginator);
>         // I tried by putting setString(component,"binding","binding")
>
>      }
>
>      public void release() {
>          super.release();
>      }
>
>      public void setString(UIComponent component, String attributeName,
>              String attributeValue) {
>              if (attributeValue == null) {
>
>                  return;
>              }
>
>              if (isValueReference(attributeValue)) {
>               System.out.println("attributeName"+attributeValue);
>
>                 setValueBinding(component, attributeName, attributeValue);
>
>              } else {
>                System.out.println("attributeNameattr"+attributeValue);
>
>                  component.getAttributes().put(attributeName,
> attributeValue);
>              }
>          }
>          /**
>           * sets the value binding of an atttibute
>           * @param component
>           * @param attributeName
>           * @param attributeValue
>           */
>          public void setValueBinding(UIComponent component, String
> attributeName,
>              String attributeValue) {
>
>              FacesContext context = FacesContext.getCurrentInstance();
>              Application app = context.getApplication();
>              ValueBinding vb = app.createValueBinding(attributeValue);
>              component.setValueBinding(attributeName, vb);
>
>          }
>
>
> }
>
>
> Component binding is not working with this binding property.
>
> I even tried putting
> try {
>     super.setBinding(binding);
>    } catch (JspException e) {
>     // TODO Auto-generated catch block
>     e.printStackTrace();
>    }
>
> in set Properties method of this tag,then also component instance binding
> is not done.
> Please let me help in knowing what to do if we want to have a binding
> property in the custom tag.It will be great help if any body tell how the
> binding propery  works done in JSF.To my knowledge , _jspService  method
> calls the UIComponentTag.setBinding... and after that
> UIComponentTag.createComponentInstance is called to create the component
> with the instance given by  binding property.
>
> Thanks,
> Rajeshekar
>

Mime
View raw message