[jboss-jira] [JBoss JIRA] (AS7-6513) Mojarra 2.1.18 upgrade breaks Renderers' @ResourceDependency
Pavol Pitonak (JIRA)
jira-events at lists.jboss.org
Fri Feb 22 10:17:56 EST 2013
[ https://issues.jboss.org/browse/AS7-6513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavol Pitonak updated AS7-6513:
-------------------------------
Attachment: AS7-6513-test2.zip
The issue was partially resolved in Mojarra 2.1.20-SNAPSHOT. However, it is still broken for components inside facet. I created a new reproducer AS7-6513-test2.
# unzip and build AS7-6513-test2
# deploy
# there is my mylib.js and mylib2.js in head section of the page (one comes from composite component, one from output component)
# click "increment" button
# now mylib.js file is missing so you'll get a JavaScript error when you click on first button
> 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
> Priority: Critical
> Labels: regression
> Attachments: AS7-6513-test.tar, AS7-6513-test.war, AS7-6513-test2.zip
>
>
> 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