You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Udo Schnurpfeil (JIRA)" <de...@myfaces.apache.org> on 2017/09/06 13:29:01 UTC

[jira] [Commented] (TOBAGO-1785) link="/" may render a wrong href

    [ https://issues.apache.org/jira/browse/TOBAGO-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16155326#comment-16155326 ] 

Udo Schnurpfeil commented on TOBAGO-1785:
-----------------------------------------

a JS workaround might look like this:

{code}
  // XXX Hotfix for link="/". Is not needed in Tobago 4, because of new attribute "outcome".
  fixRootLinks: function(elements) {
    elements.find("a").each(function () {
      var href = jQuery(this).attr("href");
      if (href === null || href === "") {
        return;
      }
      if (href === "/faces/" || href === "/.xhtml") {
        href = "/";
      } else if (href.startsWith("/faces/?") || href.startsWith("/faces/;")
          || href.startsWith("/.xhtml?") || href.startsWith("/.xhtml;")) {
        href = "/" + href.substring(7);
      }
    });
  },
{code}

(call this method from Tobago.initDom())

> link="/" may render a wrong href 
> ---------------------------------
>
>                 Key: TOBAGO-1785
>                 URL: https://issues.apache.org/jira/browse/TOBAGO-1785
>             Project: MyFaces Tobago
>          Issue Type: Bug
>          Components: Themes
>    Affects Versions: 3.0.5
>            Reporter: Udo Schnurpfeil
>            Priority: Minor
>
> When using suffix-mapping for the FacesServlet and using
> {code}
> <tc:link link="/" /> 
> {code}
> the resulting href may look like href="/.xhtml" which isn't defined.
> This is because the change of TOBAGO-1752, which fixes the window-id parameter.
> Workarounds:
> * Don't use this, but use e.g. link="/index.xhtml" instread.
> * Write a small JS Script to fix these cases.
> This is not a Tobago 4 problem, because of the new outcome parameter. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)