8 Replies Latest reply on Mar 31, 2011 3:57 PM by manilche

    Creating a simple Action not working

    mikool

      Hi everybody.


      I created this action with the seam eclipse plugin:


      import javax.ejb.Stateless;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.faces.FacesMessages;
      
      @Stateless
      @Name("helloWorld")
      public class HelloWorldAction implements HelloWorld {
              
          @Logger private Log log;
              
          @In FacesMessages facesMessages;
          public String getOutputText()
          {
              return "HelloWorld!";
          }
      }
      


      The plugin also created this interface:


      import javax.ejb.Local;
      
      @Local
      public interface HelloWorld {  
          
              //seam-gen method
              public String getOutputText();  
      }



      Finally the plugin also created a page for me but I changed it to this:


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:rich="http://richfaces.org/rich"
                      xmlns:a="http://richfaces.org/a4j">
      
      <f:view>
              <h:outputText value="#{helloWorld.outputText}"/>
      </f:view>
      
      </ui:composition>
      



      But instead of a simple HelloWorld output I get this message:


      javax.el.PropertyNotFoundException: /helloWorld.xhtml @12,50 value="#{helloWorld.outputText}": Property 'outputText' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1



      Did I forget something?
      I'm happy about every single hint.


      Mike

        • 1. Re: Creating a simple Action not working
          coolex

          Maybe you should try it with the seam-gen?

          • 2. Re: Creating a simple Action not working
            lich

            Hi,
               getOutputText() is a Method not a Property.  so you should...
              
               helloWorld.getOutputText

            • 3. Re: Creating a simple Action not working
              mikool

              Hi!


              I tried it but I still get the same output with the property not found, now for getOutputText.


              I have copied the example from this book.
              Is it a mistake in the book?

              • 4. Re: Creating a simple Action not working
                coolex

                Even Eclipse does not suggest to write the method name instead Eclipse suggest just to write outputText. But still the same problem.


                So how can I solve it? Isn't it possible to use methods with return values?

                • 5. Re: Creating a simple Action not working
                  mikool

                  So Axel, since you have the same problem, I guess it is not possible in SEAM to create methods with return values in actions.
                  It is working in entities only I think.


                  Am I right?

                  • 6. Re: Creating a simple Action not working
                    mail.micke

                    Use the property way of calling it, it is the JSF way. Seam adds the posibility of calling methods, but that is not needed when it follows the java beans naming standard.


                    This bit of the error message seems interesting :


                    not found on type org.javassist.tmp.java.lang.Object_$$_javassist_1
                    



                    Seems like it is proxying java.lang.Object which won't have that method, so the question is why isn't it proxying the correct object? (seem to remeber seeing something similar in the forum but can't remeber where).


                    • 7. Re: Creating a simple Action not working
                      manilche

                      As the error says, the component class defined by helloworld has no property called outputText, eg no getOutputText method. If you the component class implements an interface you may have forgot to specify the method declaration there

                      • 8. Re: Creating a simple Action not working
                        manilche

                        anil guru wrote on Mar 31, 2011 15:56:


                        As the error says, the component class defined by helloworld has no property called outputText, eg no getOutputText method. If you have the component class implements an interface you may have forgot to specify the method declaration there


                        Click HELP for text formatting instructions. Then edit this text and check the preview.