Monday, June 30, 2014

af:table pagination ADF JDev 11.1.1.7

Pagination in ADF

*If the table is inside a Panel Stretch Layout, the pagination doesn't work

Friday, June 27, 2014

Configure Servlets in web.xml ADF (Read the AMPool values on the server using a servlet dynamically)


Access it by going to http://<application-context-root>/faces/AMPoolInfo

- The below Servlet displays the AM pool current instance parameters of an application running on the server


      package views;

import javax.servlet.http.HttpServlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.*;
import javax.servlet.http.*;

import java.util.Enumeration;

import java.util.Iterator;
import java.util.Map;

import oracle.jbo.common.ampool.ApplicationPool;
import oracle.jbo.common.ampool.PoolMgr;

public class AMPoolStatisticsServlet extends HttpServlet {
    private static final String CONTENT_TYPE =
        "text/html; charset=windows-1252";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response) throws ServletException,
                                                           IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>AM Pool Statistics</title></head>");
        out.println("<body>");
        PoolMgr poolMgr = PoolMgr.getInstance();
        String poolname = request.getParameter("poolname");
        if (poolname == null || poolname.equals("")) {
            Enumeration keys = poolMgr.getResourcePoolKeys();
            if (keys != null) {
                out.println("<h3>List of Active Application Module Pools</h3>");
                out.println("<ul>");
                while (keys.hasMoreElements()) {
                    String s = (String)keys.nextElement();
                    out.println("<li><code><a href='AMPoolInfo?poolname=" + s +
                                "'>" + s + "</a></code></li>");
                }
                out.println("</ul>");
            } else {
                out.println("No pools.");
            }
        } else {
            out.println("<h3>Pool Statistics for Pool '" + poolname +
                        "'</h3>");
            out.println("<a href='AMPoolInfo'>Back to Pool List</a>");
            out.println("<hr><blockquote><pre>");
            
            ApplicationPool pool =
                (ApplicationPool)poolMgr.getResourcePool(poolname);
            
            out.println("<BR><H1>Avilable Pool count </h1>" +pool.getAvailableInstanceCount());
                
            out.println("<BR><H1>Environment Parameter</H1>");
           
            Iterator iterator = pool.getEnvironment().entrySet().iterator();
                    while (iterator.hasNext()) {
                            Map.Entry entry = (Map.Entry) iterator.next();
                        out.println("<H1> "+ entry.getKey().toString() +" : " + entry.getValue().toString() +" </H1>");
                    }
           
            
            pool.dumpPoolStatistics(new PrintWriter(out));
            out.println("</pre></blockquote>");
        }
        out.println("</body></html>");
        out.close();
    }
}
Reference : ADF E'x'plorer