Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set VO bind variable on page loading programmatically

Endrik LeloAug 22 2013 — edited Sep 4 2013

Greetings everyone!

I use JDeveloper version 11.1.2.3.0

I am currently trying to get some filtered data from a VO, based on a WHERE clause with a bind variable. This process should be done on page load. I have to set this bind variable with the id of the logged user (the part of getting this id is already achieved and used somewhere else). My current approach is defining a managed bean with pageFlow scope. Inside this i have a method in which i retrieve the id and i set it as the parameter value. The code snippet:

      BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface
       operationBinding.getParamsMap().put("username", getUserName());
      Object userID = operationBinding.execute();
        setUserId(Integer.parseInt(userID.toString()));
       System.out.println("THE USER ID IS: "+getUserId());
       BindingContainer bindings2 = getBindings();
       OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams");  // i've dragged and dropped the ExecuteWithParams operation into the page
       operationBinding2.getParamsMap().put("userId", getUserId());  // userId is the bind variable which i'm talking about
        Object result = operationBinding2.execute();


Then, i call this method on BeforePhase in the page view. It works, i get the filtered data and the println shows me the correct ID. The problem is that each time i select a row in the table showing the data, the page seems to reload and it always get the selection back at the very first row.

What am i doing wrong? May be this is not the right approach, as i've seen some other posts about this topic but they are not very clear to me.

Please advice

This post has been answered by Endrik Lelo on Sep 4 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2013
Added on Aug 22 2013
4 comments
573 views