Showing posts with label throw new oaexception syntax. Show all posts
Showing posts with label throw new oaexception syntax. Show all posts

Sunday, 3 June 2018

Exception handling in OAF

Exception handling in OAF


There are 3 types of exceptions can be thrown on OAF pages (java).

a)Warning  : This will display the custom message and no effect in the oaf page execution

b)Information  : This will display the custom message and no effect in the oaf page execution

c)Error : This will display the custom message and has effect in the oaf page execution.

It stops the page execution by throwing message as a exception

 

 

Exception handling in paf page has done through Try and catch block syntax.

Try Block :- All logic should be kept in a try block to handle exceptions.

In this block we do all our coding part , so that if any exception raised in the logic or cading part then it will be handled through catch block.

 

Catch Block – Once control find any exception in the try block, it goes to catch block. Catch block will be used to handle the raised exception.

 throw new oaexception syntax


for Example -

 

try{ 

custom code
{

 

}  

  
}

      
catch(Exception e)

         
{

  // For Warning Message

 

throw new OAException("Exception " +e, OAException.WARNING);        

    

 // For Information Message             

throw new OAException("Exception " +e,  OAException.INFORMATION);  

               

// For Error Message


throw new OAException("Exception " +e,  OAException.ERROR);            

           
 }

 

If exception occurs in custom code, control will come to catch block and it will print the relative exception message on the screen.

 

Exception handling in OAF

oaexception in oaf.Display message in oaf page

oaexception in OAF.Display message in oaf page


OA Exception is used in OAF to display messages in the OAF Pages. OA framework display these messages on the top of the OAF page. We can display warning message in oaf as well as error and information kind of messages too.
 

There are four types of OA messages, we can print/show in the OAF page through oaexception/

1.Error.

2.Confirmation

3.Informations

4.Warning.

 

How to display confirmation message in oaf

Each message Type have their own means. We can display the OAException with the below ways in OAF Page.

 

If you want to show the Warning messages in the OAF page then can you can use this below system in Process Request or Process Form Request.

 

Here below I am taking an Example, When user will click on the Go button , then warning message should be show in the OAF page so for this I am putting this code under ‘ Process Form Request.’

 throw new oaexception syntax


  if(pageContext.getParameter("Go")! =null)

    {

 

      throw new OAException(‘You are entering something wrong’,OAException.WARNING);

 

Or You can also use this below syntax too

OAException msg1 = new OAException(‘You are entering something wrong’,OAException.WARNING);

pageContext.putDialogMessage(Msg1);

 

endif;

 
 

 

 

To Display Error Messages: -

 

  if(pageContext.getParameter("Go")! =null)

    {

 

      throw new OAException(‘You are entering something wrong’,OAException.ERROR);

 

Or You can also use this below syntax too

OAException msg1 = new OAException(‘You are entering something wrong’,OAException.ERROR);

pageContext.putDialogMessage(Msg1);

 

endif;

 

 

The same way you can work for ‘Information’ & ‘confirmation’
 
oaexception in oaf.Display message in oaf page

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *