English 中文(简体)
Pass request parameters through FacesContext
原标题:

I moved from JSF 1.2 to JSF 2.0 and it seems I missed something during the switch. I have following scenario:

  1. There is a button on one page with actionListener set to one managed bean s method which adds an object to request by calling FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("foo", fooObject);
  2. Navigation is properly handled to other page where other managed bean is initialized.
  3. The constructor of other managed bean tries to retrieve passed object from request by calling FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("foo"); and to initialize itself with received values.

Both managed beans are request scoped. I notice that constructor can t retrieve proper value from request because request map doesn t contain "foo" key.

What am I doing wrong? Is there a better way to do this?

Thanks in advance.

最佳回答

In step 2, if there is a redirect the initial request scope is lost as the redirect would result in another request.

问题回答

暂无回答




相关问题
parameter passing to a standalone qooxdoo application

How can I pass parameters to a stand alone qooxdoo applicatoin? Thanks in advance :) update: I was thinking of passing URL parameters; something like GET/POST params when an html FORM is submitted. ...

parameter passing to a shared object function

i have a c-application which should load a shared object at runtime and call an arbitrary function of the shared object. The shared object was build by the user and gave me the signature of his ...

jQuery, how to call a function while passing a variable

I want to use jQuery s .get method to send an ajax call to the server. I am using this line: $.get("InfoRetrieve", { },addContent(data)); As you can see I want to call a function call addContent ...

Passing a value from child window to parent

Here is my scenario: i have a parent web page, in my javascript code I open a new window. This new window is a server-side aspx page. This child page needs to save some data in the database, and after ...

热门标签