1 Reply Latest reply on Oct 1, 2008 1:36 PM by Stuart Douglas

    Param Element In Pages.xml Causing Reflection Error

    Lee Theobald Newbie

      Hi all,

      I'm having a problem with my Seam code and I can't seem to figure out what I'm doing wrong.  It's doing my head in :)  Here's an excerpt of the stack trace (can post the whole thing if it helps):

      Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.oobjects.sso.manager.home.PresenceHome.customerId to java.lang.String

      I'm trying to get a parameter set on my URL passed into one of my beans.  To do this, I've got the following set up in my pages.xml:

      <page view-id="/customer/presences.xhtml">
        <begin-conversation flush-mode="MANUAL" join="true" />
        <param name="customerId" value="#{presenceHome.customerId}" />
        <raise-event type="PresenceHome.init" />
          <rule if-outcome="persisted">
            <end-conversation />
            <redirect view-id="/customer/presences.xhtml" />

      My bean starts like this:

      public class PresenceHome extends EntityHome<Presence> implements Serializable {
        private CustomerDao customerDao;
        @In(required = false)
        private Long presenceId;
        @In(required = false)
        private Long customerId;
        private Customer customer;
        // Getters, setters and other methods follow. They return the correct types defined above

      Finally the link I use to link one one page to the next looks like this:

      <s:link styleClass="#{selected == 'presences' ? 'selected' : ''}"
          view="/customer/presences.xhtml" title="Presences" propagation="none">
          <f:param name="customerId" value="#{customerId}" />

      All this seems to work fine.  When I hover over the link above in my page, I get a URL ending in something like '?customerId=123'.  So the parameter is being passed over and it's something that can be easily converted into a Long type.  But for some reason, it's not.  I've done similar things to this before in other projects and it's worked then.  I just can't see what it isn't working now.

      If I remove the <param> element from my page declaration, I get through to the page fine.  This also seems to be something that is happening intermediately (although I could be wrong here).

      So, does anyone have any thoughts?