2 Replies Latest reply on May 24, 2008 2:34 PM by Steven Melzer

    problem with @In and value attribute using JSF EL

    Steven Melzer Newbie

      I have several types of users in my application and I want to be able to inject a concrete User component based on a common User interface so that classes can delegate functionality to the correct User class.  So I did the following in a Seam Component called 'searchAction' that needs user functions:


      
      @Name("searchAction")
      
      public class SearchAction {
      
         @In(value="#{sessionScope.userType}")
      
         User user;
      
      


      (A lot was taken out for readability so ignore the general syntax)


      Where User is an interface and I have several User implementations such as ReadOnlyUser and SuperUser.  When the user logged in I do the following in the login method:


      
      Contexts.getSessionContext().set("userType", "SuperUser");
      
      



      But I am getting the following error when Seam tries to handle the injection:


      
      java.lang.IllegalArgumentException: 
      
      Could not set field value: searchAction.#{sessionScope.userType}
      
      
      



      searchAction is the name of the Seam Component that the injection is in.


      Why is the Seam Component showing up in the value at all?  Why is it not resolving the expression?


      Any thoughts?


      Thanks,
      Steve