3 Replies Latest reply on Dec 22, 2009 8:29 PM by Jeff Palmer

    Creating status messages

    Jeff Palmer Newbie

      I'm trying to create status messages in my application to provide feedback any time a CRUD operation occurs. According to the Seam in Action book, this can be accomplished by overriding the create() method on the Home component like so:




      @Override public void create() {
      setCreatedMessage("You've successfully added #{course.name}. " + "Thanks for contributing!");



      Something must have changed in the later versions of Seam, however, since setCreatedMessage() now takes a ValueExpression and not a String. I couldn't find any examples online on how to use a ValueExpression to accomplish this, though, so I was hoping someone might be able to lend a hand.


        • 1. Re: Creating status messages
          Ilya Dyoshin Novice

          Take a closer look into documentation.


          you can override method getCreatedMessage():


              protected String getCreatedMessage() { return createValueExpression("You've  successfully added #{course.name}. Thanks for contributing"); }




          Regards,


          Ilya Dyoshin

          • 2. Re: Creating status messages
            Jeff Palmer Newbie

            I ended up doing the following:


            @Override
            public void create() {
                 setUpdatedMessage(createValueExpression("Employee #{employee.fullName} has been updated."));
            }



            This works well for the most part. What I'm noticing, however, is that the EL notation in the message is never getting displayed. For example, the message above is getting displayed as Employee has been updated instead of Employee Jim Jones has been updated. Any suggestions?

            • 3. Re: Creating status messages
              Jeff Palmer Newbie

              Figured out what I was doing wrong. I forgot to override the getInstance() method that returns the employee instance being used in the value expression


              #{employee.fullName}