You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Jeanne Waldman <je...@oracle.com> on 2008/04/16 00:14:33 UTC

LinkRenderer calls writeURIAttribute... but why?

Hi there,

I'm wondering if anyone knows why the links id needs to call 
writeURIAttribute instead of writeAttribute.

The code is in GoLinkRenderer. The comment says that they are URI 
attributes, but it doesn't say why. I have some of my own code that does 
the same thing for links , but it causes a problem if the id is 
non-ascii, like Japanese. I can fix this issue by calling 
writeAttribute, but I don't want to cause other problems that I'm just 
not aware of.
Thanks for any insights!!
- Jeanne


  /**
   * Renders the client ID as both "id" and "name"
   */
  @Override
  protected void renderId(
    FacesContext context,
    UIComponent  component) throws IOException
  {
    if (shouldRenderId(context, component))
    {
      String clientId = getClientId(context, component);
      // For links, these are actually URI attributes
      context.getResponseWriter().writeURIAttribute("id", clientId, "id");
      context.getResponseWriter().writeURIAttribute("name", clientId, "id");
    }
  }



[Trinidad] LinkRenderer calls writeURIAttribute for id... but why?

Posted by Jeanne Waldman <je...@oracle.com>.
forgot to add [Trinidad] to the subject.

Jeanne Waldman wrote, On 4/15/2008 3:14 PM PT:
> Hi there,
>
> I'm wondering if anyone knows why the links id needs to call 
> writeURIAttribute instead of writeAttribute.
>
> The code is in GoLinkRenderer. The comment says that they are URI 
> attributes, but it doesn't say why. I have some of my own code that 
> does the same thing for links , but it causes a problem if the id is 
> non-ascii, like Japanese. I can fix this issue by calling 
> writeAttribute, but I don't want to cause other problems that I'm just 
> not aware of.
> Thanks for any insights!!
> - Jeanne
>
>
>  /**
>   * Renders the client ID as both "id" and "name"
>   */
>  @Override
>  protected void renderId(
>    FacesContext context,
>    UIComponent  component) throws IOException
>  {
>    if (shouldRenderId(context, component))
>    {
>      String clientId = getClientId(context, component);
>      // For links, these are actually URI attributes
>      context.getResponseWriter().writeURIAttribute("id", clientId, "id");
>      context.getResponseWriter().writeURIAttribute("name", clientId, 
> "id");
>    }
>  }
>
>
>

[TRINIDAD] LinkRenderer calls writeURIAttribute... but why? (was: LinkRenderer calls writeURIAttribute... but why?)

Posted by Scott O'Bryan <da...@gmail.com>.
Hey Jeanne, we ran across these quite a while ago when we did the 
initial portal compatibility enhancements.  I really didn't look at it 
too much at the time, but Adam seemed to think that these were necessary 
for bookmarks..  I managed to find this thread:

http://markmail.org/message/vq6v2nr4ntqcam4t

Does anyone know if what Adam said is true or understand what 
implication NOT making encoding these attributes might do?

Scott

Jeanne Waldman wrote:
> Hi there,
>
> I'm wondering if anyone knows why the links id needs to call 
> writeURIAttribute instead of writeAttribute.
>
> The code is in GoLinkRenderer. The comment says that they are URI 
> attributes, but it doesn't say why. I have some of my own code that 
> does the same thing for links , but it causes a problem if the id is 
> non-ascii, like Japanese. I can fix this issue by calling 
> writeAttribute, but I don't want to cause other problems that I'm just 
> not aware of.
> Thanks for any insights!!
> - Jeanne
>
>
>  /**
>   * Renders the client ID as both "id" and "name"
>   */
>  @Override
>  protected void renderId(
>    FacesContext context,
>    UIComponent  component) throws IOException
>  {
>    if (shouldRenderId(context, component))
>    {
>      String clientId = getClientId(context, component);
>      // For links, these are actually URI attributes
>      context.getResponseWriter().writeURIAttribute("id", clientId, "id");
>      context.getResponseWriter().writeURIAttribute("name", clientId, 
> "id");
>    }
>  }
>
>