OAF: Passing Parameters between pages
Following are three common means of passing parameters between pages:
- Request
- Transaction
- Session
In addition the values set in the View Attributes are available to all pages participating in the transaction.
Request :
- Short-lived object created for each HTTP request.
- It contains following application state:
- URL Parameters
- Updatable Field values (Message Text Input etc) and Hidden Field Values (form values) in case of post
- Event trigggering bean and the action in case of post.
- Request values are accessed using OAPageContext.getParameter() methods.
- In OAF, we don't interact with Request directly, we interact with Request through PageContext.
Ways to pass parameters in Request:
- Adding in URL: We can specify parameters as literal values or token substituted values (mapped to VO Attributes). Following are the examples:
- OA.jsp?page=/xxabc/oracle/apps/xxabc/custommodule/webui/CustomPG&order={@OrderNum}
- OA.jsp?OAFunc=XXABC_ADM_SUPP_ENGR&asset=123
- OAPageContext.putParameter()
- Values are not technically added to request, but are stored in a special page cache.
- Equivalent to HttpServletRequest.setAttribute()
- Hidden fields (form values)
- Passing parameters in Hashmap using setForwardUrl().
Passing parameters in Hashmap is the better approach for following reasons:
- URL has size restrictions.
- URL is visible to users.
- putParamater() and hidden fields are not stored in Request as parameters, thus if we navigate with Breadcrumbs or for other reasons in case the webBean hierarchy needs to be reconstructed, these will not be available.
Transaction:
Transaction has wider scope than Request thus its not preferred approach.
- OAPageContext.putTransactionValue()
- OAPageContext.getTransactionValue()
- ((OADBTransactionImpl)getTransaction()).putValue()
- ((OADBTransactionImpl)getTransaction()).getValue()
Session:
Again, a wider scope than Transaction and not recommended.
- pageContext.putSessionValue();
- pageContext.getSessionValue();
Using VO Attributes for passing values
Values stored in VO attributes are available in all pages within the transaction with same Root AM.
Using VO Attributes for passing values
Values stored in VO attributes are available in all pages within the transaction with same Root AM.
URL Parameters : Encryption and Encoding
When we are passing parameters in URL, following need to be considered:
{@Attr} - encodes. Changes Prince Kapoor to Prince%20Kapoor
{!Attr} - encrypts. Encrypts sensitive information.
{$Attr} - plain token substitution (no encoding or encryption)
{@@RETURN_TO_MENU} - Used for E-Business Suite Personal Home Page. Same as OAWebBeanConstants.RETURN_TO_MENU_URL.
{@@RETURN_TO_PORTAL} - Return the user to a launching Portal page. Same as OAWebBeanConstants.RETURN_TO_PORTAL_URL.
{!Attr} - encrypts. Encrypts sensitive information.
{$Attr} - plain token substitution (no encoding or encryption)
{@@RETURN_TO_MENU} - Used for E-Business Suite Personal Home Page. Same as OAWebBeanConstants.RETURN_TO_MENU_URL.
{@@RETURN_TO_PORTAL} - Return the user to a launching Portal page. Same as OAWebBeanConstants.RETURN_TO_PORTAL_URL.
Good One. Nice tips and tricks. Keep posting.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete