3 Replies Latest reply on Feb 27, 2011 3:55 AM by bora bora

    actionMethod parameter with xhtml suffix

    bora bora Newbie

      Hi All,


      This might be a basic question yet I couldn't find any information on the topic in the forums (or google). So here it goes...


      I am working on Seam URL rewriting at the moment and everything (all navigations) seems all right except for the fact that s:link tags create the URL's with xhtml suffixes for actionMethod parameter.


      For example, after clicking logout I get the below URL. This is a very basic test application that is created by Seam-Gen.
      http://localhost:8080/MyApp/home.htm?actionMethod=home.xhtml:identity.logout


      Is there any way to change this behaviour such that the url contains actionMethod=home.htm instead of actionMethod=home.xhtml? And from where is this actionMethod parameter coming? I have checked the Redirect.java but it seems the code segment that puts this parameter is commented out. Basically, I am just curious if it is possible to completely hide the underlying technology that is deployed for the web application from the users' viewpoint.


      Any pointers would be appreciated very much.


      My suffixes are all htm by the way (web.xml and components.xml).


      I am using Seam 2.1.2, JBoss 4.2.3.


      Thanks,
      Bora.

        • 1. Re: actionMethod parameter with xhtml suffix
          Todd Morrison Newbie
          Hey Bora.

          Check out the layout folder in your web/view directory.
          Here, you will find a menu.xhtml which is included on the default layout template (f:view).

          You should see something like :
                  <s:link id="menuLogoutId" view="/home.xhtml" action="#{identity.logout}" value="Logout" rendered="#{identity.loggedIn}" propagation="none"/>

          Here, you can see that there is a 'redirecting' viewId, as well as an action method which serves as component binding on post-back.

          I believe the 'view' property on this tag is what you want to change for the logout redirect to work against home.htm.

          Alternatively, you can also handle this routing in the pages.xml by something like this:

          <page view-id="/login.xhtml">
              <action execute="#{authenticator.logoutAndRedirectToLoginPage}" if="#{identity.loggedIn}"/>
          </page>

          Where, there exists a backing stateless component with method

            public void logoutAndRedirectToLoginPage() {
                  identity.logout();
                  Redirect r = new Redirect();
                  r.setViewId("/home.htm");
                  r.setConversationPropagationEnabled(false);
                  r.execute();
              }

          This will allow you to redirect a logged in user to the login page, then automatically log them out based on the login url.

          You can see that the Redirect type has very similar parameters to the s:Link attributes.

          Not the best use-case for all, but a good example of how you can route activity in the pages.xml


          Hope that helps!
          Todd
          • 2. Re: actionMethod parameter with xhtml suffix
            bora bora Newbie

            I am not sure how I missed this reply but thanks!
            It's been a while though..

            • 3. Re: actionMethod parameter with xhtml suffix
              bora bora Newbie

              BTW, I have edited the menu.xhtml and it's still the same.
              So that one doesn't work.
              I couldn't try the others.