[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3345) Seam buttons don't render path in relative images

Jorge Rodr??guez Pedrianes (JIRA) jira-events at lists.jboss.org
Thu Aug 28 03:02:38 EDT 2008


Seam buttons don't render path in relative images
-------------------------------------------------

                 Key: JBSEAM-3345
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3345
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.1.0.BETA1, 2.1.0.A1, 2.0.3.CR1
         Environment: Seam 2.0.3.CR1
            Reporter: Jorge Rodr??guez Pedrianes


Hello!

Using s:button i see that when i try to use a image attribute this don't put the relative paht of my application in de generated code.

For example:

   <s:button image="/resources/images/icons/edit.gif" value="Edit" action="#{bean.action}" type="button" />

but this render:

    <input  src="/resources/images/icons/edit.gif ...>

I think that must render this:

    <input  src="/My-Request-Context-Path/resources/images/icons/edit.gif ...>

In doEncodeBegin Method of ButtonRendererBase class you can see that don't transform the image URL. 

A solution is encode the url. For example:

    private static String src(FacesContext context, UIButton uiButton) {

        String image = uiButton.getImage();
        if (image == null) {
            return "";
        }
        image = context.getApplication().getViewHandler().getResourceURL(context, image);
        return (context.getExternalContext().encodeResourceURL(image));
    }
And then in doEncodeBegin make this:

    ...

      if (button.getImage() != null)
      {
         writer.writeAttribute(HTML.SRC_ATTR, src(context, button), HTML.SRC_ATTR);
      } 

   ...


Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list