4 Replies Latest reply on Oct 24, 2008 5:39 PM by Nick Belaevski

    Passing Long value to rich:menuItem via f:param rounds and c

    Anton Polyakov Newbie

      Hi All!

      I'm quite a new to RF, so please don't kick me if I'm asking dumb questions.
      I have encountered a strange problem - when I try to pass very long Long value to rich:menuItem component via f:param, I get incorrect (cut and rounded value). Here is the code:

      <f:view>
       <h:form>
       <rich:contextMenu attached="false" id="menu" submitMode="server">
       <rich:menuItem immediate="true" action="#{testBean.someAction}">
       Download document <b> {name}</b> with id {currentDocId}
       </rich:menuItem>
       </rich:contextMenu>
       <rich:dataGrid value="#{testBean.objects}" var="item" columns="3"
       elements="9" width="600px">
       <h:panelGrid columns="1">
       <h:outputText value="#{item.name}, #{item.id}" />
       <rich:componentControl event="onclick" for="menu" operation="show">
       <f:param value="#{item.id}" name="currentDocId" />
       <f:param value="#{item.name}" name="name" />
       </rich:componentControl>
       </h:panelGrid>
       <f:facet name="header">
       <rich:datascroller />
       </f:facet>
       </rich:dataGrid>
       </h:form>
      </f:view>
      

      bean looks like:
      @Name("testBean")
      @Stateful
      @Scope(ScopeType.SESSION)
      @AutoCreate
      public class TestBean implements ITestBean{
      ...
      public TextObject[] getObjects() {
       TextObject obj = new TextObject();
       obj.setId(new Long("81022231438000081"));
       obj.setName("name 81022231438000081");
       return new TextObject[] {obj};
       }
      }
      

      I got the following result:
      <h:outputText value="#{item.name}, #{item.id}" /> returns correct values:
      "name 81022231438000081, 81022231438000081"
      but in the menu item I receive:
      "Download document name 81022231438000081 with id 81022231438000080"

      Please help me, I'm completely stuck. Moreover, if I modify getId method to return id.toString(), everything is fine and everything also is fine if id is not that long.

      Thank you in advance!