5 Replies Latest reply on Oct 29, 2007 6:08 AM by pmuir

    meta http-equiv refresh and JSF/Seam?

    dpocock



      A Seam page displays some data from an entity bean.

      The database is updated regulary by another process.

      Is it possible for the Seam page to auto-refresh in the browser, and automatically fetch the new data from the database?

      I've observed the following:

      - If the meta tag for refresh is used, the action method that populates the backing bean is never called. <meta http-equiv="refresh" content="30" />

      - If I create a `reload' button on the page, which calls the action, the data does update.

      Is it possible to generate a `refresh' meta-tag that will do the same thing as the JSF commandButton I've used for reload?

      Is there another way to solve this problem using JSF, Seam or Javascript?

        • 1. Re: meta http-equiv refresh and JSF/Seam?
          pmuir

          How about using a RichFaces Ajax poll (a:poll) approach?

          • 2. Re: meta http-equiv refresh and JSF/Seam?
            dpocock



            The application is based on the DVD store example - Facelets, session beans, etc. It is not too complicated.

            Is there a way to solve this problem without adding Rich Faces or other dependencies?

            Ideally, I would like to generate URL that can be used with the `GET' method, and embed that URL in the refresh meta-tag.

            • 3. Re: meta http-equiv refresh and JSF/Seam?
              pmuir

              Well the commandButton submits the form which you can't do from a meta tag. However, look at the link s:link creates for calling action methods (you'll need to put a corresponding s:link on the page for it to be a "safe" action to call).

              • 4. Re: meta http-equiv refresh and JSF/Seam?
                dpocock



                I'm familiar with s:link.

                Could <s:link> be generalised in some way to generate a meta tag instead of generating an tag?

                Or would it be more desirable to develop a solution that uses some kind of EL code to populate the `content' element of the meta-tag, or potentially for populating any other element that requires a URL?

                I would prefer to find or implement a solution within Seam rather than having a custom tag that only exists in my own code.

                • 5. Re: meta http-equiv refresh and JSF/Seam?
                  pmuir

                  I've never seen anyone else ask for this before so I don't see a need to add anything to Seam. If you are using Seam2, I refactored out the common logic to generate the URL from s:link/s:button, so build a component which extends UISeamCommandBase and call it's getUrl method to generate the URL - this will also make your action safe. If you develop something useful, feel free to create a JIRA issue and attach your code as a patch.