myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lindberg <grebdn...@hotmail.com>
Subject Re: @ViewAccessScoped does not work!
Date Fri, 04 Nov 2011 22:20:35 GMT

I updated to 1.0.1 version.

I using prettyfaces 3.3.0 and when I use pretty the ViewAccessScoped does
not work. When I remove pretty works. What can i do? Is there any required
configuration or integration to use myfaces CODI  with prettyfaces? 

When i return in my action method the view by pretty does not work. But i
return using 'navigation-case' works.

A.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/pages/template/main.xhtml">
	
<ui:define name="body">
   <h:form>
   		
   		<h:inputText value="#{testMB.text}"/>
   		
		<h:commandButton value="Next Page" action="#{testMB.myAction}"
ajax="false"/>
   </h:form>

</ui:define>

</ui:composition>

B.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/pages/template/main.xhtml">
	
<ui:define name="body">
   <h:form>
   		
   		<h:outputText value="#{testMB.text}"/>

   </h:form>

</ui:define>

</ui:composition>

pretty-config.xml

<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.2.1
http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.2.1.xsd">

	<rewrite match="^/(.*)/$" substitute="/$1" redirect="301" />

	<url-mapping id="pageB">
		<pattern value="/pageB" />
		<view-id value="/pages/B.jsf" />
	</url-mapping>

</pretty-config>

TestMB.java

package br.gov.serpro.scds.view.managedbean;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;

import
org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessScoped;

@ManagedBean
@ViewAccessScoped
public class TestMB implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private String text;
    
    public TestMB() {
        //
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
    
    public String myAction(){
        return "pretty:pageB";//Using pretty does not work
    }
    
}

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	version="3.0">
	<filter>
		<filter-name>Pretty Filter</filter-name>
		<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>Pretty Filter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>
	
</web-app>

When I change my action in TestMB to return "navigation-case" declared in
faces-config.xml works.

faces-config
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0">

<navigation-rule>

<navigation-case>
               <from-outcome>pageB</from-outcome>
                <to-view-id>/pages/B.xhtml</to-view-id>
            </navigation-case>
</navigation-rule>  
	          
</faces-config>

And now my action method in TestMB returns navigation-case 'pageB' and works

public String myAction(){
        return "pageB";
    }

How can i solve this problem? Thanks!







Gerhard Petracek wrote:
> 
> @mark:
> i agree with you that using the latest version makes a lot of sense,
> however we never had such an issue.
> 
> @lindberg:
> please provide more details (e.g. how you are navigating to view 'B').
> 
> regards,
> gerhard
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 
> 
> 2011/11/4 Mark Struberg <struberg@yahoo.de>:
>> Hi!
>>
>> As first step you should upgrade to extcdi-1.0.1 which got released 2
>> months ago.
>> This is the last stable version. 0.9.5 was one of our very first public
>> packages and we fixed a _lot_ issues since then.
>>
>> LieGrue,
>> strub
>>
>>
>>
>> ----- Original Message -----
>>> From: lindberg <grebdnnil@hotmail.com>
>>> To: dev@myfaces.apache.org
>>> Cc:
>>> Sent: Friday, November 4, 2011 8:09 PM
>>> Subject: Re: @ViewAccessScoped does not work!
>>>
>>>
>>> I am using
>>> myfaces-extcdi-dist-jsf2  version 0 0.9.5
>>> primefaces version 2.2.1
>>>
>>> lindberg wrote:
>>>>
>>>>  I have a bean 'X' annotated with @ViewAccessScoped but this scope
>>> does not
>>>>  work. When i access the view 'A' that uses the bean X and does
>>> change to
>>>>  view 'B' that uses the bean 'X' too, i lose the bean state.
>>> How can i
>>>>  solve this problem? Below my configuration:
>>>>
>>>>  config implementation:
>>>>  org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig
>>>>     method:    isUseViewConfigsAsNavigationCasesEnabled
>>>>     value:    true
>>>>
>>>>     method:    isAlwaysKeepMessages
>>>>     value:    true
>>>>
>>>>     method:    isInitialRedirectEnabled
>>>>     value:    true
>>>>
>>>>     method:    isInvalidValueAwareMessageInterpolatorEnabled
>>>>     value:    true
>>>>
>>>>  config implementation:
>>>>
>>> org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig
>>>>     method:    isUrlParameterSupported
>>>>     value:    true
>>>>
>>>>     method:    isUnknownWindowIdsAllowed
>>>>     value:    false
>>>>
>>>>     method:    isAddWindowIdToActionUrlsEnabled
>>>>     value:    false
>>>>
>>>>     method:    getWindowContextTimeoutInMinutes
>>>>     value:    60
>>>>
>>>>     method:    getMaxWindowContextCount
>>>>     value:    64
>>>>
>>>>     method:    isCloseEmptyWindowContextsEnabled
>>>>     value:    false
>>>>
>>>>     method:    isEagerWindowContextDetectionEnabled
>>>>     value:    true
>>>>
>>>>     method:    isCreateWindowContextEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isCloseWindowContextEventEnabled
>>>>     value:    false
>>>>
>>>>  config implementation:
>>>>
>>> org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig
>>>>     method:    isScopeBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isAccessBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isUnscopeBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    getConversationTimeoutInMinutes
>>>>     value:    30
>>>>
>>>>     method:    isStartConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isCloseConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isRestartConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isConversationRequiredEnabled
>>>>     value:    true
>>>>
>>>>  MessageContextConfig class:
>>>>  org.apache.myfaces.extensions.cdi.message.impl.DefaultMessageContextConfig
>>>>     MessageInterpolator class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.FacesMessageInterpolator
>>>>     MessageResolver class: class
>>>>
>>> org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareApplicationMessagesMessageResolver
>>>>     MessageHandler class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareMessageHandler
>>>>     LocaleResolver class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareLocaleResolver
>>>>     FormatterFactory class: class
>>>>  org.apache.myfaces.extensions.cdi.message.impl.DefaultFormatterFactory
>>>>
>>>>  16:56:05,234 INFO
>>>>  [org.apache.myfaces.extensions.cdi.jsf2.impl.Jsf2ModuleStartupObserver]
>>>>  [Started] MyFaces CODI JSF-Module v0.9.5 for JSF 2.0
>>>>  Used JSF implementation: Mojarra v2.0.3-
>>>>
>>>>  config implementation:
>>>>  org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig
>>>>     method:    isUseViewConfigsAsNavigationCasesEnabled
>>>>     value:    true
>>>>
>>>>     method:    isAlwaysKeepMessages
>>>>     value:    true
>>>>
>>>>     method:    isInitialRedirectEnabled
>>>>     value:    true
>>>>
>>>>     method:    isInvalidValueAwareMessageInterpolatorEnabled
>>>>     value:    true
>>>>
>>>>  config implementation:
>>>>
>>> org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig
>>>>     method:    isUrlParameterSupported
>>>>     value:    true
>>>>
>>>>     method:    isUnknownWindowIdsAllowed
>>>>     value:    false
>>>>
>>>>     method:    isAddWindowIdToActionUrlsEnabled
>>>>     value:    false
>>>>
>>>>     method:    getWindowContextTimeoutInMinutes
>>>>     value:    60
>>>>
>>>>     method:    getMaxWindowContextCount
>>>>     value:    64
>>>>
>>>>     method:    isCloseEmptyWindowContextsEnabled
>>>>     value:    false
>>>>
>>>>     method:    isEagerWindowContextDetectionEnabled
>>>>     value:    true
>>>>
>>>>     method:    isCreateWindowContextEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isCloseWindowContextEventEnabled
>>>>     value:    false
>>>>
>>>>  config implementation:
>>>>
>>> org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.ConversationConfig
>>>>     method:    isScopeBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isAccessBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isUnscopeBeanEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    getConversationTimeoutInMinutes
>>>>     value:    30
>>>>
>>>>     method:    isStartConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isCloseConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isRestartConversationEventEnabled
>>>>     value:    false
>>>>
>>>>     method:    isConversationRequiredEnabled
>>>>     value:    true
>>>>
>>>>  MessageContextConfig class:
>>>>  org.apache.myfaces.extensions.cdi.message.impl.DefaultMessageContextConfig
>>>>     MessageInterpolator class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.FacesMessageInterpolator
>>>>     MessageResolver class: class
>>>>
>>> org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareApplicationMessagesMessageResolver
>>>>     MessageHandler class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareMessageHandler
>>>>     LocaleResolver class: class
>>>>  org.apache.myfaces.extensions.cdi.jsf.impl.message.JsfAwareLocaleResolver
>>>>     FormatterFactory class: class
>>>>  org.apache.myfaces.extensions.cdi.message.impl.DefaultFormatterFactory
>>>>
>>>>  16:56:05,234 INFO
>>>>  [org.apache.myfaces.extensions.cdi.jpa.impl.JpaModuleStartupObserver]
>>>>  [Started] MyFaces CODI JPA-Module v0.9.5
>>>>
>>>>  16:56:05,250 INFO
>>>>  [org.apache.myfaces.extensions.cdi.core.impl.CoreStartupObserver]
>>>>  [Started] MyFaces CODI (Extensions CDI) Core v0.9.5
>>>>  Used CDI implementation: Weld v6.0.0.Final
>>>>
>>>>  project-stage: Production
>>>>  project-stage class:
>>>>
>>> org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage$Production
>>>>
>>>>  application-parameters:
>>>>     name:    com.sun.faces.duplicateJARPattern
>>>>     value:    ^tmp\d+(\S*\.jar)
>>>>
>>>>     name:    resteasy.injector.factory
>>>>     value:    org.jboss.resteasy.cdi.CdiInjectorFactory
>>>>
>>>>     name:    com.sun.faces.injectionProvider
>>>>     value:
>>>>  org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider
>>>>
>>>>     name:    resteasy.unwrapped.exceptions
>>>>     value:    javax.ejb.EJBException
>>>>
>>>>  config implementation:
>>>>  org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig
>>>>     method:    isConfigurationLoggingEnabled
>>>>     value:    true
>>>>
>>>>     method:    isAdvancedQualifierRequiredForDependencyInjection
>>>>     value:    true
>>>>
>>>>     method:    isInvalidBeanCreationEventEnabled
>>>>     value:    false
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/%40ViewAccessScoped-does-not-work%21-tp32782652p32782676.html
>>> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/%40ViewAccessScoped-does-not-work%21-tp32782652p32783950.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Mime
View raw message