0

I start with the page "blabla.page1?id=8"

In that page I need to get some input from user and execute some task (with web service - doesn't matter so much)

page1 is managed by bean1 (which declared as @RequestScoped) which contains values according to the given ID.

I want that the user will have to click a button before the task will be preformed, then

he will be moved to page2 where the result of the task will be printed as well as some

other values of bean1.

What I have now is:

<h:form> Enter code
<h:inputText value="#{bean1.input}" />
<h:commandButton value="go" action="#{bean1.task}"/>
</h:form>

and

public String sendCode()
{
    ...
    return "page2?faces-redirect=true"
}

The outcome is:

The result of the task is printed but the picutre is of the defualt item since the content of bean1 is erased (I believe it is because the request is finished or something).

Suggestions?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1692261
  • 1,197
  • 3
  • 16
  • 30
  • I can't actually understand what do you mean with `h:inputText` here. Also with "it has to be with href because the bean is @RequestScoped". You probably are misunderstanding concepts. – Aritz Feb 25 '13 at 19:54
  • obviously the values of bean1 are cleaned since request is finished. You must pass the values from bean1 to bean2, you have several ways to achieve that. By the way, what happened with the other response here? – Aritz Feb 25 '13 at 21:55
  • When I use bean1 is not cleaned (but I didn't managed to combine it with the task). Currently there is no bean2 because I do nothing on page2. If there are several ways I would be glad to here some of them please. I have no idea what happen with the other response. Maybe when I edited the question it was deleted? thank you Biker. – user1692261 Feb 26 '13 at 06:06
  • One of the ways I prefer to pass objects between beans is using [JSF 2 flash scope](http://mkblog.exadel.com/2010/07/learning-jsf2-using-flash-scope/). It makes the content you put available only for the next request, so you could use it in bean2. – Aritz Feb 26 '13 at 07:31

0 Answers0