Question

I have a @viewScoped bean( say bean1) having an inputText as property .From the facelet, Iam setting the value of this inputtext field. However after the submit operation when the other facelet (whose managed bean say bean2 is in @viewScoped ) as well is loaded ,I need to retrieve the bean1 inputText values but iam not able to retrieve .I know in viewscoped bean the state is lost once we move to next view but is there a way to retrieve the values ? because i need to show the values in the next facelet ... By the way Iam using ajax so the bean has to be viewscoped

I even tried the following code in bean2 (@viewScoped) .but the sysout shown below is always null

@ManagedProperty(value="#{bean1}")
private Bean1 bean1;

System.out.println(bean1.getinputtext());

both the beans have to be in @viewScoped .Is there a way I can retrieve the values from bean 1 to bean 2 ? Thanks in advance

Was it helpful?

Solution

You can't access first view scoped bean any more. You can add your data to session, read that data from second bean and remove the data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top