Wednesday, January 7, 2009

ADF 10g : How to show faces message both globally and below the UI component.

Hi all,
Welcome again, after a long time I am finally back on blogging.. in the time of economy recession!I think I was not able to update my blog from almost last 7-8 months because of various resons, joining new company, working new technologies of Oracle Fusion and working on multiple projects simultaneously.

In the past 6 months i have worked as an architect on two ADF 10G projects. When I compare ADF with my OA Framework experience, I find ADF to be much more challenging as well as flexible to mold as per the requirement in your project.

From now I would be coming up with small articles on ADF which will be helpful, to develop useful APIs by product architects, so that other developers would be able to use them , without worrying about the actual implementation.

One task in ADF which looks very easy, is showing of different jsf messages.One great feature of ADF is that Faces messages can be shown globally at the top of page, as well as just below the UI ADF bean, which is very illustrative for users.

CASE I:Showing Global Message in an ADF page
-----------------------------------------------
1)af:messages tag is used for showing global messages in an ADF page.This tag is created automatically whenever you drop an input widget from the
Data Control Palette. However, if you need to insert the tag, simply insert the
following code within the afh:body tag:


2. In the Property Inspector set the following attributes:
■ globalOnly: By default ADF Faces displays global messages (i.e., messages
that are not associated with components) followed by individual component
messages. If you wish to display only global messages in the box, set this
attribute to true. Component messages will continue to display with the
associated component.
■ message: The main message text that displays just below the message box
title, above the list of individual messages.
■ text: The text that overrides the default title of the message box.

Code for displaying global Faces message :
//You need to enter error description
String error_decp="";
//You need to enter error detail
String error_detail="";
//Get current instance of faces context
FacesContext fc = FacesContext.getCurrentInstance();
//Creating faces message with description and detail
FacesMessage message = new FacesMessage(error_descp, error_detail);
//setting severity of message,i.e. message type
message.setSeverity(FacesMessage.SEVERITY_ERROR);
//Adding message to faces context.
fc.addMessage(null, message);

CASE II:Showing Faces Message in an ADF UI COMPONENT along with global error message:
-----------------------------------------------------------------------------

a)JSF Validator :
-------------------
This approcah is typically used when you have same kind of validation repeatdly in your code. Lets take a very generic example you need to verify that the entered number should have precision of 2 decimal places, i.e. whatever number user enters should have 2 digits after decimal.You can write a jsf validator for this register in the application and use in any othe pages. If you are new to JSF validator just search google you will find numerous examples of how to write a JSF validator.



b) Directly adding message with UI component based of custom code in backing bean:
--------------------------------------------------------------------------------

i)In complex data UI components like table:
--------------------------------------------
String global_error=""; //Error that need to be shown at top of the page
String component_error="";//Error that need to be shown on the component
String formId="";// Id of Form bean
String TableId="";//Id of table bean
String rowIndex="";//String value of row index
String message="";//message type

FacesContext fc = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(global_error, component_error);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
fc.addMessage(formId+":"+TableId+":"+String.valueOf(rowIndex)+":"+ComponentId, message);


ii)In simple data UI components like input text:
---------------------------------------------
FacesContext fc = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(global_error, component_error);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
fc.addMessage(formId+":"+ComponentId, message);

I hope the above article has provided a brief description about how to show global and UI specific messages , you can use in ADF via JSF APIs.

Wednesday, July 16, 2008

Hide "Privacy Link" and "Copy right information" from dialog page!

Explaination By Kali:

Try the following,
Login with the user who has functional administrator and goto pesonalization tab,
query the document path,
/oracle/apps/fnd/framework/webui/OAFooter
press go, once you get the doc name /oracle/apps/fnd/framework/webui/OAFooter
click on Personalize Page icon,

Clear all other default values and uncheck the site check box,
and select OAFWK_DIALOG_PG in Function.
Then apply,

You will get personalization struction the /oracle/apps/fnd/framework/webui/OAFooter at Function OAFWK_DIALOG_PG level,

Now change the rendered propertly to false for Privacy Link and Copy right.

Then check the dialog page.

Sunday, July 6, 2008

Creation Of the Anonymous page Introduction( By Kalimuthu Vellaichamy,Senior Consultant,Oracle )

1.1 Purpose
This document explains the OAFramework (ver 5.7 H for Apps 11.5.9 and 5.10 for Apps 11.5.10) Anonymous User page (like registration page) development and deployment in an instance and pack for the other instances.
This document assumes that the reader has a basic knowledge of OA Frmework page creation and deployment.

1.2 Background
This document should be used for creating Guest User pages and all type of registration pages. When this document fails to cover a topic, recommendations from OA Framework Development Team should be followed. If you have a Guest user page to display that does not require a user to log in.

1.3 Related Documents
1. OA Framework Developers’ Guide
2 Creation Of the Anonymous page

2.1 New page with anonymous user setup.

To create a page with anonymous setup we should have a standard OAFramework page with all the components required for the page.
We have to create the function for this page.
Let us consider a Registration page NewEmpRegistrationPG.xml and the registered function for this page is NEW_EMP_REGN.
We have to change the following properties for the MainRN for the page.
Rendered: ${oa.FunctionSecurity. NEW_EMP_REGN}
Security Mode: selfSecured



Use the following command to upload the page to the instance,
java oracle.jrad.tools.xml.importer.XMLImporter -username -password -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=))(CONNECT_DATA=(SID=)))" -rootdir ./ -rootPackage

Example.
java oracle.jrad.tools.xml.importer.XMLImporter NewEmpRegistrationPG.xml -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=I3SN021E.idc.oracle.com)(PORT=1610))(CONNECT_DATA=(SID=scmtrng)))" -rootdir ./ -rootPackage /xxt/oracle/apps/pon/registration/webui

2.2 Create a function for the new page
Use functional administrator (Self Service) or using system administrator (Forms) responsibility and create a function for the uploaded page.






After the function creation we have to add this function to a menu and the menu has to be granted to GUEST user.

2.3 Add the function to a new menu
Use fuctional administrator responsibility to create a new Menu. Add the created function with this new menu.





Now we are ready with the menu that is having a function, which points to a page which we want to access without the user log in.
If you want to give access to more than one page you can add, as many functions to the menu, like below.




2.4 Create Grant for the created menu.
To create Grant for the menu we have created now, use Security Tab in the functional administrator responsibility. Follow the below mentioned steps.




Step I: Log on to Application with Functional Administrator Responsibility and click on functional administrator responsibility. Click on “Create Grant” button (To create a Global Grant)




Step II: Enter the Grant Name and select Grantee Type as “All Users” and click “Next”



Step III: Enter the User Menu Name of the newly created Menu and click “Next”


Step IV : Click “Finish” button


Step V: Again click on “Create Grant” (To create Guest Grant)



Step VI : Enter the Grant Name and select Grantee Type as “Specific User”. The page refreshes to display a new field called “Grantee” (If the page fails to refresh click “Next” button to go to the next screen and click “Back” button on the next screen to come back to this screen)
Enter “GUEST” in the “Grantee” field and click “Next”



Step VII: Enter the User Menu Name of the newly created Menu and click “Next”




Step VIII : Click “Finish” button



Step IX: Grant creations successfully completed.

3 Download and Upload the Grant
Following command used to download the created Grant.
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct XXTGUESTGRT_US.ldt GRANT GNT_MENU_NAME= NEW_EMP_REGN_MENU
To upload this grant into a new instance upload the page and the menu as usual and upload the Grant for the menu using the following command.
Following command used to upload the downloaded Grant.
FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct XXTGUESTGRT_US.ldt
No we can access the newly created page without login into the applications using the following URL.
http://: /OA_HTML/OA.jsp?OAFunc=NEW_EMP_REGN

Tuesday, July 1, 2008

Disable Browser Back Button in OAF

Hi all,
These days I am so muh busy with SOA, ADF and Bpel projects that I do not get time to write articles. But recently helped a friend in old team for fixing browser back button in one of his OAF transaction pages which was creating error in his page.

Basically a small trick used in various J2EE projects in javascript helps to sort of nullify the browser back button in oaf page. This is what you need to do,
Put following code in process request of OAF page :
OABodyBean bodyBean = (OABodyBean) OAPageContext.getRootWebBean();
String javaS = “javascript:window.history.forward(1);”;
bodyBean.setOnLoad(javaS);


Actually window.history.forward(1) would push the current page ahead in the "visited pages history". A negative number like -1 would restore the previous visited page from browser's cache. Zero is relative to the current (displayed) page. Positive numbers would navigate forward.
If the page number (positive) does not exist in history, your browser will create an entry "copying" the current page to it and setting it as the current entry, so that the previous and actual are the same.

Using window.history.forward(1) does not disable "Back button". The button will work BUT as this script runs on page loading, it will send you "ahead" the history, which stored URL (or page) is the same. So it works like a "Refresh" button, without actually refreshing content from server, but just restoring from cache.
Hope this helps all.

Wednesday, May 14, 2008

Some facts About R12 OAF techstack

As Applications R12 is maturing and stabilising , we are seeing more and more R12 projects coming up. One prominent question I find very often on Oracle OAF forums as well as e mails, is there any change is relation of OA Framework components development and deployment in R12?? Here is list of some changes which you will come across while working on any R12 project:

1)Apache Jserv is upgraded to OC4J(Oracle Containers for Java) server in R12.

2)How to enable log in R12?Since there is no Jserv as in 11i, there is no more dependency on jserv.properties file for enabling of log.Here are the details how to enable log on R12:
In R12,
Goto $ORA_CONFIG_HOME/10.1.3/opmn/conf
take the backup of opmn.xml
edit opmn.xml for data id="java-options" and add the following:
-DAFLOG_ENABLED=true -DAFLOG_LEVEL=statement
-DAFLOG_MODULE=fnd%
-DAFLOG_FILENAME=/tmp/aflog.txt -Djbo.debugoutput=console


The log message should get written in,
$INST_TOP/logs/ora/10.1.3/opmn/oacore_default_group_1/oacorestd.out


3)How to add custom classpath in OC4J server classpath ?
Add an entry in,


$ORA_CONFIG_HOME/10.1.3/j2ee/oacore/application-deployments/oacore/orion-application.xml

< library path="..."/ >

prepending the existing library path.Modifying orion-application.xml works only if you manually go and modify it. But whenever we run autoconfig orion-application.xml is generated again and it does not have the custom jar files which we had specified.
In case you need to permanently add a custom classpath to the OC4J instances then you need to update the template file

$FND_TOP/admin/template/orion_application_xml_1013.tmp
There would be some set of entries with tags like
< library path="%s_oacore_prepend_classpath%" />
< library path="%s_javatop%" />
< library path="%s_af_jlib%/ojdigsig.zip" />
< library path="%s_oacore_append_classpath%" />
< library path="%s_weboh_oh%/j2ee/forms/applications/forms/formsweb/WEB-INF/lib/frmsrv.jar" />
< library path="%s_tools_oh%/forms/java/frmxlate.jar" />
< library path="%s_weboh_oh%/j2ee/oafm/applications/mapviewer/web/WEB-INF/lib/mvclient.jar" />




you can add your custom path like this after all the existing library path entires

where /abc/xyz/classpath.jar is the path for your custom libraries



4)Autocompilation setting of jsp files in R12.
In file
$INST_TOP/ora/10.1.3/j2ee/oacore/application-deployments/oacore/html/orion-web.xml

afterwards please restart apache
$ADMIN_SCRIPTS_HOME/adapcctl.sh stopall
$ADMIN_SCRIPTS_HOME/adapcctl.sh startall
now, whenever you change a character in your jsp, this will immediate reflect your output. In production environments this setting is not recommended.


4)Steps for Manual compilation of jsp in R12.
> cd $FND_TOP/patch/115/bin
> ojspCompile.pl --compile -s hello.jsp


5) Why R12 uses two Oracle homes in ?
There is an interesting article on Steven Chan's blog on this which explains y Oracle introduced 10.1.3 and 10.1.2 both in R12 Application server archietecture:
Why Use Two ORACLE_HOMEs for Release 12's Application Tier?


6)DBC file location in R12:
$INST_TOP/appl/fnd/12.0.0/secure

7)Bouncing OC4J server, for OAF to pick latest class and xml files.
In R12, there are two scripts which need to run to bounce the HTTP server and make OC4J container pick latest class files instead of one as in 11i, we only need to run adapcctl.sh shell script to bounce Apache Jserv.

Since in R12 Jserv is replaces by OC4J container, we need to run two scripts:
1)Script which is responsible for bouncing Oracle HTTP Server (powered by Apache).(adapcctl.sh)
2)Script which responsible for bouncing OC4J container (adoacorectl.sh)

So basically, here is the sequence of steps you need to do :
1)adapcctl.sh stop
2)adoacorectl.sh stop
3)adapcctl.sh start
4)adoacorectl.sh start
All these scripts are in $ADMIN_SCRIPTS_HOME

Monday, May 12, 2008

E-Business Suite Application Development Using Oracle Application Framework (OAF) and Application Development Framework (ADF

Latest Update of the much discussed topic on Oracle OA Technology Forum ... which techstack to use OAF or ADF till the time Oracle comes up with Fusion Release, is that Oracle has now released official guidelines for using which framework OAF/ADF while building your custom web application.This white paper is there on the metalink:
E-Business Suite Application Development Using Oracle Application Framework (OAF) and Application Development Framework (ADF) (Metalink Note 563047.1)

Saturday, April 5, 2008

Discussion for deploying ADF project in R12.

Hi all,
I recently had a interesting mail conversation with couple of senior guys of Oracle regarding Deployments of ADF project in R12.Here is the conversation:


Mukul---->Hi Steven, I have worked in both OAF , ADF Faces. I would like to know is it possible to deploy a standalone adf faces j2ee application in R12 OC4J server. If yes, can anybody on this blog provide a article/ metalink note regarding this! This is really important for R12 customers to know whether they can move their custom applications in ADF or not!


Steven Chan(Steven Chan, Sr. Director, Oracle Applications Technology Integration,Oracle)---->
Hi, Prabodh,
How are you making out with the whitepaper on this subject? Can you share any information with Mukul until its release?

Regards,
Steven

Probodh(From Oracle)---->
Hi Mukul,
As far as I know, this has not been tried out internally yet, but there is nothing technically preventing you from achieving deploying an ADF app within an EBS OC4J server. I've also cc'ed Shay Shmeltzer who is the Product Manager for ADF, and who might have come across customers who have already done this.



Shay Shmeltzer(Group Manager,Oracle Development Tools) --->

I also don't know if this has been tested.

That said - as long as the OC4J that is included with EBS is the same version as the public external one and the ADF Libraries are the same this should work.

Hence, in a nut shell deploying ADF project in R12 OC4J server has not yet been tried even in internal Oracle..! Actually I was facing some problem in deployment... anyways.... if I will get time.. will try this again and will let all know a common solution.

Regarding deployment of any ADF project in any standard j2ee server its pretty straight forward will put the screenshots for this soon with description!