You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2014/03/19 06:01:47 UTC

[jira] [Commented] (MYFACES-3873) Problems while using javax.faces.view.ViewScoped for dynamic css generation

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

Leonardo Uribe commented on MYFACES-3873:
-----------------------------------------

Thanks for the example. I tried it, changing richfaces from 5.0.0-SNAPSHOT to 5.0.0-Alpha3 and the problem is what you are trying to do cannot be done. The reason is you are trying to access a view scope bean from a resource request, which has another different context, so in this case CDI or whatever you use will  throw a ContextNotActiveException. 

The request that process the view and the request that serves the resource are two independent requests, and the resource request does not have values like the view state or the client window, so the minimal scope where this can work is SessionScope. There is nothing we can do from MyFaces side, so I'll close this issue as invalid, since there is problem in the implementation. Thanks anyway for the report and for take MyFaces Core into account. I'll keep an eye on further issues you can find.

> Problems while using javax.faces.view.ViewScoped for dynamic css generation
> ---------------------------------------------------------------------------
>
>                 Key: MYFACES-3873
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3873
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.1
>         Environment: tomcat-7.0.50, java7
>            Reporter: Rene O
>         Attachments: jsftest22.zip
>
>
> In my testcase i use javax.faces.view.ViewScoped for a bean (net.jsftest.Theme) which generates my theme.
> You can see, that this doesn't work inside the used css file (resources/main.css):
> http://localhost:8080/jsftest22/pages/theme/themetest1.jsf
> @PostConstruct is never called, so the bean is not initialized
> It works inside page:
> http://localhost:8080/jsftest22/pages/theme/themetest2.jsf
> If you use javax.enterprise.context.SessionScoped within net.jsftest.Theme both cases works.
> The problem also occurs in current mojarra implementation



--
This message was sent by Atlassian JIRA
(v6.2#6252)