0

I have two questions in one. First off all, I don't understand how to use the rich:componentControl, I used an old code and this website: https://community.jboss.org/wiki/RichFaces33-4xMigrationGuideUnleashed but I still have this error whatever I try:

javax.servlet.ServletException: /admin.xhtml @191,30 Parent not an instance of ClientBehaviorHolder: javax.faces.component.html.HtmlOutputText@1ee71d84 javax.faces.webapp.FacesServlet.service(FacesServlet.java:521) com.lesim.fst.service.FilterUTF8.doFilter(FilterUTF8.java:20)

There is my code:

<rich:column>
  <h:outputText value="#{msg.la8}" id="actionId" >
    <rich:componentControl event="onmouseover" target="menu" operation="show" />
  </h:outputText>
  <rich:contextMenu id="menu" mode="client">
    <rich:menuItem label="#{msg.ll8}" onclick="functionEdit();" icon="/images/edit16.png" />
    <rich:menuItem label="#{msg.ll9}" onclick="functionSuppr();" icon="/images/supprimer16.png" />
  </rich:contextMenu>
  <a4j:jsFunction name="functionEdit" action="#{administrateurBean.editAdministrateur()}" >
    <a4j:param value="#{administrateur.idadministrateur}" name="idadministrateur" />
  </a4j:jsFunction>
  <a4j:jsFunction name="functionSuppr" action="#{administrateurBean.deleteAdministrateur()}">
    <a4j:param value="#{administrateur.idadministrateur}" name="idadministrateur" />
  </a4j:jsFunction>
</rich:column>

My goal is to show the rich:contextMenu when the h:outputText is onmouseover, and the rich:componentControl is needed because the onmouseover attribute don't work for rich:contextMenu (according to this website : https://issues.jboss.org/browse/RF-7497 )

You can also see that I don't directly use my Bean methodes, I put them in an a4j:jsFunction. It is because the action attribute don't work for rich:menuItem (according to this website: [Oh no... I can't give this one... I thought you were asking to give a maximum of my own search but apparently you don't want it so much... ] ) So I used his solution, but the redirection from the faces-config doesn't work

faces-config:

<navigation-rule>
  <display-name>admin.xhtml</display-name>
  <from-view-id>/admin.xhtml</from-view-id>
  <navigation-case>
    <from-action>#{administrateurBean.editAdministrateur}</from-action>
    <from-outcome>edit</from-outcome>
    <to-view-id>/editAdministrateur.xhtml</to-view-id>
    <redirect/>
  </navigation-case>
  <navigation-case>
    <from-action>#{administrateurBean.deleteAdministrateur}</from-action>
    <from-outcome>list</from-outcome>
    <to-view-id>/admin.xhtml</to-view-id>
    <redirect/>
  </navigation-case>
</navigation-rule>

If someone sees a way to fix one of my problems, or both, you're welcome

Thanks, Quentin

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
Hideyuki
  • 1
  • 2

1 Answers1

0

As the error message says h:outputText is not a behavior holder component (in particular this component does not trigger 'mouseover' event).

Refer to the documentation: http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/

You can use for example h:outputLabel instead (note that event name is mouseover)

  <h:outputLabel value="#{msg.la8}" id="actionId">
    <rich:componentControl event="mouseover" target="menu" operation="show"/>
  </h:outputLabel>

Or this way using onmouseover attribute:

   <h:outputLabel value="#{msg.la8}" id="actionId"
                  onmouseover="${rich:component('menu')}.show()"/>
Andrey
  • 6,526
  • 3
  • 39
  • 58