6 Replies Latest reply on Sep 8, 2008 5:19 PM by Sebastian Hort

    How to use the Seam HtmlIUComponents for Custom Validation?

    Sebastian Hort Newbie

      Hi Forum,


      i have a problem and maybe someone could help.


      i use custom validation in my application and if the validation fails
      i want to set a special style to an UIComponent in the ViewRoot.


      if the UIComponent is a subcomponent of javax.faces.component.html. all is fine


      UIComponent comp \= FacesContext.getCurrentInstance().getViewRoot().findComponent("id123");
      javax.faces.component.html.HtmlOutputText comp \= (javax.faces.component.html.HtmlOutputText)comp;
      comp.setStyle("errors");



      But if the UIComponent a subcomponent of org.jboss.seam.ui.component.html.

      if got a ClassCastException.



      UIComponent comp \= FacesContext.getCurrentInstance().getViewRoot().findComponent("id123");
      org.jboss.seam.ui.component.html.HtmlDiv comp \= (org.jboss.seam.ui.component.html.HtmlDiv)comp;
      comp.setStyle("errors");


      Is it possible to access this kind of seam UIComponents in the way i tried?
      When not, how can i access the Seam UIComponents than?


      Thanks for any hint or help! :)