[jboss-jira] [JBoss JIRA] (AS7-6513) Mojarra 2.1.18 upgrade breaks Renderers' @ResourceDependency

Marek Schmidt (JIRA) jira-events at lists.jboss.org
Tue Feb 12 11:31:56 EST 2013


Marek Schmidt created AS7-6513:
----------------------------------

             Summary: Mojarra 2.1.18 upgrade breaks Renderers' @ResourceDependency
                 Key: AS7-6513
                 URL: https://issues.jboss.org/browse/AS7-6513
             Project: Application Server 7
          Issue Type: Bug
          Components: JSF
    Affects Versions: 7.2.0.Alpha1
         Environment: AS 7.2.0.Final-prerelease1
            Reporter: Marek Schmidt
            Assignee: Stan Silvert


Since Mojarra 2.1.18 upgrade, the JSF doesn't render required @ResourceDependency of custom renderers on postback, if the component is bound.

Having an renderer:

{code}
@ResourceDependencies({ @ResourceDependency(library = "my", name = "mylib.js") })
public class MyOutputTextRenderer extends Renderer 
{
   @Override
   public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
      context.getResponseWriter().startElement("button", null);
      context.getResponseWriter().writeAttribute("onclick", "javascript:myHello();", null);
      context.getResponseWriter().writeText("Hello, world", null);
      context.getResponseWriter().endElement("button");
   }
}
{code}

And 

{code}
<h:form>
        <my:hello binding="#{counter.hello}"/>

        <h:commandButton value="Send" action="#{counter.add}" />
</h:form>
{code}

The rendered output contains the required mylib.js only in the first request, but no script element with mylib.js is rendered in the header on the page after clicking the "Send" button, thus breaking the custom component.

Note that this happens only if the the component is using the "binding" attribute.


{code}
@ManagedBean(name = "counter")
@ViewScoped
public class Counter implements Serializable
{
   private int counter = 0;
   
   private UIOutput hello;
   
   public void setHello(UIOutput hello) {
      this.hello = hello;
   }
   
   public UIOutput getHello() {
      return this.hello;
   }

   public void add()
   {
      ++counter;
   }
   
   public int getCounter() {
      return counter;
   }
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list