Basically I can't get the following to work...

faces-config snippet...

<managed-bean>
        <managed-bean-name>testObject</managed-bean-name>
        <managed-bean-class>kg.web.jsf.test.TestObject </managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>

I have a datatTable with a list of these as simple pojo's.  When clicking on one, a command link calls a function on the page's backing bean...

public String editTestObject()
    {
        FacesContext context = FacesContext.getCurrentInstance();
       
        TestObject testObject = (TestObject)testTable.getRowData();
      
        //This is where the setting code would go...
      
        return "editTestObject";
    }

'testTable' is a UIData object.  I've run the debugger, and the 'getRowData' returns the correct value.  However, no matter what I do, I can't get the managed bean set with that value.  I've tried...

1) context.getExternalContext().getRequestMap().put("testObject", testObject);

2) ValueBinding binding = context.getApplication().createValueBinding("#{testObject}");
  
        binding.setValue(context,testObject);

3) ValueBinding binding = context.getApplication().createValueBinding("#{testObject}");
  
        TestObject fromConfig = (TestObject)binding.getValue(context);
        binding.setValue(context,testObject);

The third one I tried just to see if getting the value first would cause it to be created to avoid the re-create later.  Anyway, if stuff the object into the sessionMap instead of these options, it works.

I'm frustrated because I'm not doing a redirect, but it still just won't work.  So, how would I set a top level managed bean with a value at the request scope without putting it into the session?      

On 5/10/06, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
On 5/10/06, Kevin Galligan <[EMAIL PROTECTED]> wrote:
> I see how those work, but none of them is really doing what I want to do.
> You know?  Is it not possible to manually populate a request scope bean?

Guess I'm not following what you're asking.

For what it's worth, I manually populate request-scoped beans with
t:saveState when I want the value to persist to the next request (ie,
make the request-scoped bean act like a page-scoped bean), and I use
t:updateActionListener when I want to populate a request-scoped bean
with a specific value (like the detail record selected) in the next
request.

Reply via email to