5 Replies Latest reply on Jul 26, 2006 12:56 PM by gavin.king

    Tutorial Feedback

    texan

      These are questions I have regarding the tutorial. They may be answered later in the tutorial (in fact I know some of the answers now), but they caused confusion for me while I read the tutorial because they were unclear at that time.

      Although I'd like to get answers in this forum, my goal was to give you some feedback on the tutorial document from someone with no JSF/EJB3/Seam experience.

      Section numbers are from the PDF version of the "Reference Manual" with the tutorial embedded in it.

      Section 1.2.2 ("How it works") I'm confused about the initial rendering of the register.jsp page. What is the entry point? That is, the index.html forwards (redirects?) to a "register.seam" url. How does it know to render/display the JSP file? Does it just look for a jsp with the same name? (I can't find any references to "register.jsp" in any files in the project, so I'm assuming it's magic.) If I had wanted to go to a java bean first, before displaying the JSP, what url would I have put in the index.html file.

      Section 1.4 (ToDo list) I'm just generally confused about how the jsp gets the correct set of tasks from the list of tasks. There seems to be some magical component named "taskInstanceList" that isn't referenced anywhere in the code except for the todo.jsp file. It somehow has a list of only the "todo" tasks, but what would happen if there are other process definitions? For example, the login.java login() method goes directly to the todo.jsp page, without any reference to a particular process definition. Then the jsp page grabs what appears to be the list of all tasks...

      Also, the "update" action referenced from the JSP - what's up with that? Is that a magic action? Is it just refreshing the jsp page or is there something else happening?

      Incidently, it's annoying that the previously added todo item stays in the input field. While I can see why that happens, I presume that since I'm not using an instance variable on my action bean I can't set it to null after the "createTodo()" method.

      Sigh - I assume that all this will be cleared up in later examples - I'm just frustrated by the unkowns.

      Section 1.5 - I noticed that I can submit the page by hitting the enter key but it just reloads the page. Interestingly, it sort of submits the form, as it updates the "higher/lower" display. However, it doesn't update the other messages or the number of guesses remaining. I think that means that it's updating my bean's attributes based on the form inputs, but not calling the "guess" method. I assume there's a way in JSF/Seam to handle the form submission via the enter key, since it's a common feature of webapps.


        • 1. Re: Tutorial Feedback

          As somebody who is also working with Seam without having previously used JSF/EJB3, I have another observation: I am only very slowly perceiving the boundaries of what's done by Seam vs. Facelets vs. JSF vs. Persistence API vs. EJB3, as well as conversations and a slightly different EL. Sometimes it takes a bit of sleuthing to figure out which piece(s) (if any) provides desired functionality. It's even a bit more difficult since so many things seem to happen by "magic" because 1. there is so much going on behind the scenes, 2. it's taking a little while to get used to the annotations, and 3. sometimes there are conflicting bits of documentation (e.g. meaning of "$" and "#" in EL). I am a fan of declarative programming and DRY though and do think that it's very cool that a lot of functionality is getting implemented with relatively little code to maintain.

          I can see that some of the problem comes from the fact that Seam can work with many different stacks of packages and that that is in fact a _good_ thing. I've picked JSF, facelets, and EJB3 for my new project based largely on the recommendations I've seen from Gavin.

          Before I started any coding, I did go through pretty much the complete O'Reilly EBJ3 book by Bill Burke (ISBN 0-596-00978-X, and no, I don't have a financial interest in it) and that has helped a great deal. I keep the Seam reference up in Acrobat constantly. I am also googling a lot.

          I do know that these manuals are a pain in the *** to write and am very grateful that a lot of serious work has obviously gone into it. I suppose that the answer that I just need to become more familiar with all the various technologies may well be legitimate. I'm sorry that I don't have a constructive alternative but perhaps people who are more immersed in these technologies might see a way to make it clearer to newbies. I expect that the real answer is that when various JSRs are finally adopted, there will be an accepted standard Java EE way of doing this and that this is just the price of using stuff on the bleeding edge. Sigh.

          • 2. Re: Tutorial Feedback
            gavin.king

             

            How does it know to render/display the JSP file? Does it just look for a jsp with the same name?


            Yes, when a suffix mapping like *.seam is used for the JSF servlet, JSF uses the javax.faces.DEFAULT_SUFFIX to pick a view. By default, javax.faces.DEFAULT_SUFFIX="jsp".

            This is defined in section 2.2.1 of the JSF 1.2 spec. Actually, this URL mapping stuff is something I would like to see become *significantly* more flexible in the next rev of JSF.

            here seems to be some magical component named "taskInstanceList" that isn't referenced anywhere in the code except for the todo.jsp file


            Right, this is a built-in Seam component for working with jBPM task lists. One of the great things about Seam is that you get stuff like this for free that you would otherwise have to build yourself. The full list of built-in components is here:

            http://docs.jboss.com/seam/latest/reference/en/html/components.html

            And, of course, it is a growing list ;-)

            Also, the "update" action referenced from the JSP - what's up with that? Is that a magic action? Is it just refreshing the jsp page or is there something else happening?


            Actually its unnecessary. JSF ignores outcomes (its not an action, just an outcome) that have no navigation rule and treats them just like the null outcome.

            Incidently, it's annoying that the previously added todo item stays in the input field. While I can see why that happens, I presume that since I'm not using an instance variable on my action bean I can't set it to null after the "createTodo()" method.


            Well, this is just because the inputText in the JSP and the task in the jPDL are both bound to the same property. You could easily change this and have two different properties, and have createTodo copy from one to the other, nulling the first.

            I noticed that I can submit the page by hitting the enter key but it just reloads the page. Interestingly, it sort of submits the form, as it updates the "higher/lower" display. However, it doesn't update the other messages or the number of guesses remaining.


            I cannot reproduce this - it works fine for me.

            • 3. Re: Tutorial Feedback
              gavin.king

               

              "dbatcn" wrote:
              As somebody who is also working with Seam without having previously used JSF/EJB3, I have another observation: I am only very slowly perceiving the boundaries of what's done by Seam vs. Facelets vs. JSF vs. Persistence API vs. EJB3,


              This just means we are succeeding in our goal to make this a single, seamless, user experience of a unified programming model. ;-)

              No more stovepipes.

              • 4. Re: Tutorial Feedback
                texan

                Gavin,

                As always, thanks for the quick response! I hope I didn't come accross too negatively in my original post - sometimes sarcasm is my primary form of communication. So far I am very impressed with Seam, and I suspect that will only improve as I dig deeper!

                Now I have to dig into that facelets example and figure out how that works! I truly prefer the Tapestry model for tags, which I think Facelets provides (more or less) for JSF.

                • 5. Re: Tutorial Feedback
                  gavin.king

                  No, you did not seem negative.

                  Facelets lets you do stuff like:

                  <form jsfc="h:form">
                   <input jsfc="h:commandButton" type="submit" id="back" value="Back" action="success"/>
                  </form>


                  Which is like Tapestry in that it allows previewing by the web browser, but different to Tapestry in that it does not require a whole external XML component declaration file (something I really don't like about Tapestry).