You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Vijay Ramalingam (JIRA)" <de...@myfaces.apache.org> on 2009/09/02 16:10:32 UTC

[jira] Created: (TRINIDAD-1564) pageFlowScope values set in the constructor of a managedbean is not getting retained

pageFlowScope values set in the constructor of a managedbean is not getting retained
------------------------------------------------------------------------------------

                 Key: TRINIDAD-1564
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1564
             Project: MyFaces Trinidad
          Issue Type: Bug
         Environment: windows xp
            Reporter: Vijay Ramalingam


Hi

I have a xhtml as below. In the constructor of the managedbean, i set a value in the pageFlowScope. But after the form is submiited, i do not find the value in the pageFlowScope. Please help or advise.

My XHTML

--------------------------------------------------------------------------------

<f:view>
<h:form id="testPageFlowScope">
<br></br>

<h:inputText id="selectState" value="#{pageFlowScope.state}" required="true" requiredMessage="State is mandatory" >
</h:inputText>

<br></br>

<h:commandButton id="testPageFlowScope" value="Test PFS" action="#{amaConfig.testPageFlowScope}">
</h:commandButton>

<h:outputText value="#{testPFS.country}"/>

</h:form>
</f:view>

My managed-bean declaration in faces-config

--------------------------------------------------------------------------------

<managed-bean>
<managed-bean-name>testPFS</managed-bean-name>
<managed-bean-class>xyz.TestPageFlowScope</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>


My Bean

--------------------------------------------------------------------------------

public class TestPageFlowScope extends ManagedBase {

public TestPageFlowScope() {

super();
RequestContext requestContext = RequestContext.getCurrentInstance();
Map pageFlowScope = requestContext.getPageFlowScope(); 

pageFlowScope.put("state", "India");

}

public String getCountry(){
return "India";
}
}

Once i submit the form, i check the pageFlowScope map....but it doesn't have any values. Please help

PageFlowScope : PageFlowScopeMap@6298797[_map={}, _token=null,_children=null]

Thanks
-vijay 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1564) pageFlowScope values set in the constructor of a managedbean is not getting retained

Posted by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750806#action_12750806 ] 

Andrew Robinson commented on TRINIDAD-1564:
-------------------------------------------

I doubt this is a bug. The page flow scope only relates to the current view root, but you are trying to access it in a constructor. I would suggest trying to instantiate the objects in an action method, a get method or in a phase listener attached to the view root. When you put it in a constructor, you cannot be sure what view that pageFlowScope is being assigned to, especially when your backing bean is request scope, which can span two views.

> pageFlowScope values set in the constructor of a managedbean is not getting retained
> ------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1564
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1564
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>         Environment: windows xp
>            Reporter: Vijay Ramalingam
>
> Hi
> I have a xhtml as below. In the constructor of the managedbean, i set a value in the pageFlowScope. But after the form is submiited, i do not find the value in the pageFlowScope. Please help or advise.
> My XHTML
> --------------------------------------------------------------------------------
> <f:view>
> <h:form id="testPageFlowScope">
> <br></br>
> <h:inputText id="selectState" value="#{pageFlowScope.state}" required="true" requiredMessage="State is mandatory" >
> </h:inputText>
> <br></br>
> <h:commandButton id="testPageFlowScope" value="Test PFS" action="#{amaConfig.testPageFlowScope}">
> </h:commandButton>
> <h:outputText value="#{testPFS.country}"/>
> </h:form>
> </f:view>
> My managed-bean declaration in faces-config
> --------------------------------------------------------------------------------
> <managed-bean>
> <managed-bean-name>testPFS</managed-bean-name>
> <managed-bean-class>xyz.TestPageFlowScope</managed-bean-class>
> <managed-bean-scope>request</managed-bean-scope>
> </managed-bean>
> My Bean
> --------------------------------------------------------------------------------
> public class TestPageFlowScope extends ManagedBase {
> public TestPageFlowScope() {
> super();
> RequestContext requestContext = RequestContext.getCurrentInstance();
> Map pageFlowScope = requestContext.getPageFlowScope(); 
> pageFlowScope.put("state", "India");
> }
> public String getCountry(){
> return "India";
> }
> }
> Once i submit the form, i check the pageFlowScope map....but it doesn't have any values. Please help
> PageFlowScope : PageFlowScopeMap@6298797[_map={}, _token=null,_children=null]
> Thanks
> -vijay 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1564) pageFlowScope values set in the constructor of a managedbean is not getting retained

Posted by "Vijay Ramalingam (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750825#action_12750825 ] 

Vijay Ramalingam commented on TRINIDAD-1564:
--------------------------------------------

Hi Andrew,

This might not be a bug. 

But I have set the pageFlowScope value in the constructor, because this xhtml URL(http://<domain>/mytestpageFS/xhtml/testPageFlowScope.xhtml) will be accessed from an legacy system(a struts application). say like there will a hyperlink in the legacy system,  the user will click the link and the link will point to above URL. ( hence no action method )

I have a series of xhtml pages from there, hence i tried to set the pageFlowScope value in the constructor. My testPageFlowScope.xhtml is referencing pageFlowScope. it doesn't work. 

I shall try the other alternative suggested by you.

Thanks
-vijay




> pageFlowScope values set in the constructor of a managedbean is not getting retained
> ------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1564
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1564
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>         Environment: windows xp
>            Reporter: Vijay Ramalingam
>
> Hi
> I have a xhtml as below. In the constructor of the managedbean, i set a value in the pageFlowScope. But after the form is submiited, i do not find the value in the pageFlowScope. Please help or advise.
> My XHTML
> --------------------------------------------------------------------------------
> <f:view>
> <h:form id="testPageFlowScope">
> <br></br>
> <h:inputText id="selectState" value="#{pageFlowScope.state}" required="true" requiredMessage="State is mandatory" >
> </h:inputText>
> <br></br>
> <h:commandButton id="testPageFlowScope" value="Test PFS" action="#{amaConfig.testPageFlowScope}">
> </h:commandButton>
> <h:outputText value="#{testPFS.country}"/>
> </h:form>
> </f:view>
> My managed-bean declaration in faces-config
> --------------------------------------------------------------------------------
> <managed-bean>
> <managed-bean-name>testPFS</managed-bean-name>
> <managed-bean-class>xyz.TestPageFlowScope</managed-bean-class>
> <managed-bean-scope>request</managed-bean-scope>
> </managed-bean>
> My Bean
> --------------------------------------------------------------------------------
> public class TestPageFlowScope extends ManagedBase {
> public TestPageFlowScope() {
> super();
> RequestContext requestContext = RequestContext.getCurrentInstance();
> Map pageFlowScope = requestContext.getPageFlowScope(); 
> pageFlowScope.put("state", "India");
> }
> public String getCountry(){
> return "India";
> }
> }
> Once i submit the form, i check the pageFlowScope map....but it doesn't have any values. Please help
> PageFlowScope : PageFlowScopeMap@6298797[_map={}, _token=null,_children=null]
> Thanks
> -vijay 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.