Passing parameters from one OAF page to another OAF Page
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:
o
OA.jsp?page=/xxabc/oracle/apps/xxabc/custommodule/webui/CustomPG&order={@OrderNum}
o
OA.jsp?OAFunc=XXABC_ADM_SUPP_ENGR&asset=123
·
OAPageContext.putParameter()
o
Values are not technically added to request, but
are stored in a special page cache.
o
Equivalent to HttpServletRequest.setAttribute()
·
Hidden fields (form values)
·
Passing parameters in Hashmap using setForwardUrl().
1.HashMap xxhashMap = new HashMap(1);
xxhashMap .put("ParamName1", "Value1");
xxhashMap .put("ParamName1", "Value1");
oapagecontext.setForwardURL("MY_FUNCTION", (byte)0, null, xxhashMap , true, "N", (byte)0);
OR
oapagecontext.setForwardURL("OA.jsp?page=/xxelng/oracle/apps/per/hiring/webui/XXConfermationPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, xxhashMap , true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAWebBeanConstants.IGNORE_MESSAGES);
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, xxhashMap , true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
OAWebBeanConstants.IGNORE_MESSAGES);
You can then retrieve this parameter in processRequest() via:
oapagecontext.getParameter("ParamName1");
Passing parameters in Hashmap is the better approach for
following reasons:
1.
URL has size restrictions.
2.
URL is visible to users.
3.
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();
nicely explained. thanks
ReplyDelete