Question: Committing through java code in your managed bean.
Answer:
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding(“Commit”);
operationBinding.execute();
Question: Rollback transaction through java code in your managed bean.
Answer:
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding(“Rollback”);
operationBinding.execute();
Pay attention to the operation binding names, if you have CRUD operations from different application modules within the same page, those names will differ (generally: Commit1, Rollback1 etc)
Question: Calling a VO from another VO or AM.
Answer:
//in you Application module Impl or VOImpl file have the follwing code written inside the //method which will set the value for another vo. Lets say UploadView is the View object that //you would want to set the value
ViewObject vo = findViewObject("tUploadView");
//if its not in Application Module, you will have to get the VO instance either from iterator if //you are using this code in the bean get the rowset of UploadView
RowSet rs = vo.getRowSet();
while(rs.hasNext()){ //iterate through
Row r = rs.next(); //get the row
r.setAttribute("ValueItem", value); //set the value..
//ValueItem is the Attribute that you want to set
}
}
Question: Write code to access the current row and/or the view object inside your bean?
Answer: Code to access the current row and or the view object inside your bean:
BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
DCBindingContainer dcbc = (DCBindingContainer) bc;
DCIteratorBinding lBinding = dcbc.findIteratorBinding("EmployeesViewIterator");
EmployeesViewRow row = (EmployeesViewRow) lBinding.getCurrentRow();
EmployeesView view = (EmployeesView) lBinding.getViewObject();
Question:How to declare the page navigation (navigation rules) in faces-config.xml file in ADF 10g?
Answer: Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:
<naviagation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</naviagation-rule>
This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.
Question: Why 'timeZone' attribute is required when <af:convertDateTime> is used?
Answer: When <af:convertDateTime> is used it takes by default GMT time, for Indian timing we need to take GMT+5.30
<af:inputText id="compId3882"
label="#{messageBean['SS_DATE_OF_BIRTH']}"
disabled="true" maximumLength="50"
value="#{bindings.DateofBirth.inputValue}"
inlineStyle="font-size:smaller; font-weight:normal; font-family:Arial;color:rgb(69,69,69);">
<af:convertDateTime timeZone="GMT+5:30" pattern="dd/MM/yyyy"/>
</af:inputText>
Question: How to set the range of table?
Answer: <af:table rows=”#{bindings.LoggedInUserServiceRequests.rangeSize}”…/>
Question: How to Use the pageFlowScope Scope Within Java Code?
Answer: You can access pageFlow scope from within any Java code in your application. Remember to clear the scope once you are finished. To use pageFlowScope in Java code:
1. To get a reference to the pageFlowScope scope, use following method:
org.apache.myfaces.trinidad.context.RequestContext.getPageFlowScope();
2. For example, to retrieve an object from the pageFlowScope scope, you might use the following Java code:
import java.util.Map;
import org.apache.myfaces.trinidad.context.RequestContext;
3. Inside Java Method, write code below :
Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
Object myObject = pageFlowScope.get("myObjectName");
4. To clear the pageFlowScope scope, access it and then manually clear it. For example, you might use the following Java code to clear the scope:
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getPageFlowScope().clear();
Note: If your application uses ADF Controller, then you do not have to manually clear the scope.
Answer:
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding(“Commit”);
operationBinding.execute();
Question: Rollback transaction through java code in your managed bean.
Answer:
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding(“Rollback”);
operationBinding.execute();
Pay attention to the operation binding names, if you have CRUD operations from different application modules within the same page, those names will differ (generally: Commit1, Rollback1 etc)
Question: Calling a VO from another VO or AM.
Answer:
//in you Application module Impl or VOImpl file have the follwing code written inside the //method which will set the value for another vo. Lets say UploadView is the View object that //you would want to set the value
ViewObject vo = findViewObject("tUploadView");
//if its not in Application Module, you will have to get the VO instance either from iterator if //you are using this code in the bean get the rowset of UploadView
RowSet rs = vo.getRowSet();
while(rs.hasNext()){ //iterate through
Row r = rs.next(); //get the row
r.setAttribute("ValueItem", value); //set the value..
//ValueItem is the Attribute that you want to set
}
}
Question: Write code to access the current row and/or the view object inside your bean?
Answer: Code to access the current row and or the view object inside your bean:
BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
DCBindingContainer dcbc = (DCBindingContainer) bc;
DCIteratorBinding lBinding = dcbc.findIteratorBinding("EmployeesViewIterator");
EmployeesViewRow row = (EmployeesViewRow) lBinding.getCurrentRow();
EmployeesView view = (EmployeesView) lBinding.getViewObject();
Question:How to declare the page navigation (navigation rules) in faces-config.xml file in ADF 10g?
Answer: Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:
<naviagation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</naviagation-rule>
This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.
Question: Why 'timeZone' attribute is required when <af:convertDateTime> is used?
Answer: When <af:convertDateTime> is used it takes by default GMT time, for Indian timing we need to take GMT+5.30
<af:inputText id="compId3882"
label="#{messageBean['SS_DATE_OF_BIRTH']}"
disabled="true" maximumLength="50"
value="#{bindings.DateofBirth.inputValue}"
inlineStyle="font-size:smaller; font-weight:normal; font-family:Arial;color:rgb(69,69,69);">
<af:convertDateTime timeZone="GMT+5:30" pattern="dd/MM/yyyy"/>
</af:inputText>
Question: How to set the range of table?
Answer: <af:table rows=”#{bindings.LoggedInUserServiceRequests.rangeSize}”…/>
Question: How to Use the pageFlowScope Scope Within Java Code?
Answer: You can access pageFlow scope from within any Java code in your application. Remember to clear the scope once you are finished. To use pageFlowScope in Java code:
1. To get a reference to the pageFlowScope scope, use following method:
org.apache.myfaces.trinidad.context.RequestContext.getPageFlowScope();
2. For example, to retrieve an object from the pageFlowScope scope, you might use the following Java code:
import java.util.Map;
import org.apache.myfaces.trinidad.context.RequestContext;
3. Inside Java Method, write code below :
Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
Object myObject = pageFlowScope.get("myObjectName");
4. To clear the pageFlowScope scope, access it and then manually clear it. For example, you might use the following Java code to clear the scope:
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getPageFlowScope().clear();
Note: If your application uses ADF Controller, then you do not have to manually clear the scope.
No comments:
Post a Comment