10 Replies Latest reply on Aug 2, 2007 4:21 AM by Thomas Hallgren

    pages-2.0.xsd schema - undocumented features

    Wolfgang Schwendt Newbie

      I've just taken a look at the schema definition ( pages-2.0.xsd ) for the pages.xml configuration file.

      From my perspective there are two things of note:

      1) In pages.xml an element named "conversation" can be placed as child element below the "pages"-element. This conversation element can have three attributes: name, parameter-name and parameter-value.

      What is this "conversation"-element good for?


      2) The "page"-element can have a child element named "in" with the following attributes: name, scope and value.

      Again, what is the "in"-element good for?



      The Seam docs (as of Seam2.0.0Beta1) say nothing about it yet, and the Seam examples don't make use of this elements either.

      I'm aware that there's way too much traffic on this mailing list/forum and I don't want to bother the Seam developers with mundane questions, but perhaps my question is of interest to more users, so I'm posting it here.

      Regards,

      Wolfgang

        • 1. Re: pages-2.0.xsd schema - undocumented features
          Hung Tang Apprentice

           



          2) The "page"-element can have a child element named "in" with the following attributes: name, scope and value.

          Again, what is the "in"-element good for?


          in is like @In.....does injection.

          • 2. Re: pages-2.0.xsd schema - undocumented features
            Wolfgang Schwendt Newbie

             

            "hstang" wrote:

            "in" is like @In.....does injection.


            yes, "in" sounds like injection. But injection into WHAT? For @In we have a component as injection target (the instance of the class that contains the @In annotation). But what would be the injection target for the "in"-element when used in pages.xml as child element of the "page" element?


            The "in"-element can have 3 attributes:

            name (required)
            value (required)
            scope (optional)

            • 3. Re: pages-2.0.xsd schema - undocumented features
              Pete Muir Master

               

              "wschwendt" wrote:

              1) In pages.xml an element named "conversation" can be placed as child element below the "pages"-element. This conversation element can have three attributes: name, parameter-name and parameter-value.

              What is this "conversation"-element good for?


              This is currently undocumented, and we know its undocumented - sorry!

              • 4. Re: pages-2.0.xsd schema - undocumented features
                Hung Tang Apprentice

                 

                "wschwendt" wrote:
                "hstang" wrote:

                "in" is like @In.....does injection.


                yes, "in" sounds like injection. But injection into WHAT? For @In we have a component as injection target (the instance of the class that contains the @In annotation). But what would be the injection target for the "in"-element when used in pages.xml as child element of the "page" element?


                The "in"-element can have 3 attributes:

                name (required)
                value (required)
                scope (optional)


                name is the context variable name, e.g. a component name

                value is a value expression where you want to set that that looked up component

                so [in name="foo" value="#{bar.foo}"] will set your component named "foo" to your component named "bar"'s foo

                • 5. Re: pages-2.0.xsd schema - undocumented features
                  Hung Tang Apprentice

                  Now I must say since this is undocumented, what I just said to you may very well change..OR it may not. So I would just be cognizant of this fact before relying on it.

                  • 6. Re: pages-2.0.xsd schema - undocumented features
                    Wolfgang Schwendt Newbie

                     

                    "hstang" wrote:

                    The "in"-element can have 3 attributes:

                    name (required)
                    value (required)
                    scope (optional)


                    name is the context variable name, e.g. a component name

                    value is a value expression where you want to set that that looked up component

                    so [in name="foo" value="#{bar.foo}"] will set your component named "foo" to your component named "bar"'s foo


                    Thanks, hstang. Makes sense. Before posting my original question above, I had already thought about whether the in-element could be simply meant to bind a context variable to a value (e.g. seam component), as some sort of declarative prerender logic. But I didn't want to post my wild guess.

                    Anyway, if your assumption is true (have not tested it yet), the name of the element ("in") is a misnomer, as there is actually no injection. Only the value of a context variable is set.

                    But I don't know whether a better name for this element would be something like "setContextVar", for example.



                    • 7. Re: pages-2.0.xsd schema - undocumented features
                      Andy Gibson Novice

                      Obviously, this is an undocumented feature so I could be wrong here but:

                      The conversation element is for business conversation Ids, so you can define the conversation Id based on a context variable. You can also use the conversation element to define a conversation parameter definition and then refer to it by name. i.e.

                       <conversation name="widgetConv" param-name="widgetId" param-value="#{widget.id}"/>
                      
                      
                      <page view-id="widgetEdit.xhtml" conversation="widgetConv">
                      ...
                      ...
                      </page>
                      
                      


                      If you navigate to widgetEdit, it will find the value for #{widget} and use the id attribute as the conversation Id.

                      If you try to open two instances of the same widgetEdit page for the same widget (and hence the widget.id value is the same), rather than try and start a new conversation with the same Id, it will automatically switch to the existing conversation.

                      I imagine the child conversation element is so you can define the conversation business Id for that page without needing to define it outside of the page and referring to it by name from the page element.

                      Curious how that works when its a new widget and it has no Id?

                      For more information look in the docs at the Id parameter in the @Begin annotation. This has now been deprecated in 2.0 Beta 1, but it might still be in the docs, and probably referenced in the java docs. It is very likely to be in the 1.2.1 docs.

                      • 8. Re: pages-2.0.xsd schema - undocumented features
                        Thomas Hallgren Newbie

                        I've made some attempts to use the undocumented element.

                        As far as I've understood, the attributes are:

                        name
                        The name of the conversation. You use this to reference the conversation from the page clause and the name will also be prepended to the conversation id.

                        parameter-value
                        The conversation id is constructed from the value of the 'name' attribute, a colon ':' followed by the value of this expression.

                        parameter-name
                        What is this? How and where is it used?

                        • 9. Re: pages-2.0.xsd schema - undocumented features
                          Thomas Hallgren Newbie

                          Oops. Forgot to disable html. I meant to wrote "the undocumented element"

                          A related question. The element can be put in a file of its own, one for each view. It seems to me like it would be desirable to perhaps have the option declare the inline in a instead of referencing it using an attribute. That would also allow for anonymous conversations (and thus, no 'name' prepended to the conversation id).

                          <page ...>
                          <conversation parameter-name="..." parameter-value="..."/>



                          • 10. Re: pages-2.0.xsd schema - undocumented features
                            Thomas Hallgren Newbie

                            How about that. The preview of the post actually expands the html entities, not just in the previewed text, but also in your entered text. Next preview (or submit) is then corrupt. This time I used the back-button after my preview.

                            I meant to write "the undocumented &#60;conversation&#62; element"

                            A related question. The &#60;page&#62; element can be put in a file of its own, one for each view. It seems to me like it would be desirable to perhaps have the option declare the &#60;conversation&#62; inline in a instead of referencing it using an attribute. That would also allow for anonymous conversations (and thus, no 'name' prepended to the conversation id).


                            &#60;page ...&#62;
                            &#60;conversation parameter-name="..." parameter-value="..."/&#62;
                            &#60;/page&#62;