Thursday, August 29, 2013

How to Configure Servlet with ADF Faces ?


This blog explains about configuring Servlet class with ADF Page Fragment or ADF Page.

Expected Result : Whenever JSFF/JSPX page opens invoke doGet() method in Servlet class, Get the Application Module class using Databindings and invoke the method.

Implementation

- Create a Servlet class in ViewController project, which should extend to HttpServlet and override doGet() method as shown below.
- This method obtains the Application Module Impl class using Data Controller Frame name and Data Controller name. This is one of the best practice to obtain AMImpl instance in non ADF classes.

- Configure newly created Servlet in Web.xml as shown below.


- Define <af:inlineFrame> component in Page or Pagefragment as shown below, Here source value should exactly match with the servlet mapping in web.xml. This will invoke respective servlet whenever page launches.

- Implement initialize method in backing bean correspond to Page fragment, this will store the 'Data Control Frame Name' into Session scope.

- Finally, When you launch page fragment, you will see the output in console as shown below.



No comments:

Post a Comment