Monday, December 12, 2016

Send E-Mail from JAVA ADF


package com.fm.vj.view.utils;


import com.tangosol.dev.assembler.New;

import java.util.Properties;

import java.util.ResourceBundle;

import javax.faces.application.FacesMessage;

import javax.faces.context.FacesContext;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;


import javax.mail.Transport;
import javax.mail.internet.InternetAddress;


import javax.mail.internet.MimeMessage;

import oracle.adf.share.logging.ADFLogger;

import oracle.net.aso.n;

public class SendEmailUtil {
    public static final ADFLogger LOGGER = ADFLogger.createADFLogger(SendEmailUtil.class);


    /**
     * @param to
     * @param cc
     * @param from
     * @param subject
     * @param text
     */
    public static void getUtility(String to,String cc, String from, String subject, String text) {
     

  
        // Get system properties
        Properties properties = System.getProperties();

        // Setup mail server
        ResourceBundle rb = ResourceBundle.getBundle("com.jnj.brvo.view.bundles.BravoAppUIBundle");
        String host = rb.getString("SMTP_HOST"); //SMTP_HOST=SMTP.NA.FM.COM
       
        properties.setProperty("mail.smtp.host", host);
        // properties.setProperty("mail.smtp.port", "25");
        // Get the default Session object.
        Session session = Session.getDefaultInstance(properties);

        try {
            // Create a default MimeMessage object.
            MimeMessage message = new MimeMessage(session);

            // Set From: header field of the header.
            message.setFrom(new InternetAddress(from));

            // Set To: header field of the header.
           // message.addRecipient(Message.RecipientType.TO, new InternetAddress.parse(to));
           
            if (to.indexOf(',') > 0)  
                       message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));  
                   else 
                       message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));

            if (cc.indexOf(',') > 0)  
                       message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(cc));  
                   else 
                       message.setRecipient(Message.RecipientType.CC, new InternetAddress(cc));

            // Set Subject: header field
            message.setSubject(subject);

            // Now set the actual message
            message.setText(text);

            // Send message
            Transport.send(message);
            System.out.println("Sent message successfully....");
        } catch (MessagingException e) {
           
         
                        String messageText =
                            "Warning/INFO : EMail works on the BOX . Cannot be sent from local machine; The host is " + host + "";
                        FacesMessage fm = new FacesMessage(messageText);

                        fm.setSeverity(FacesMessage.SEVERITY_ERROR);
                        FacesContext context = FacesContext.getCurrentInstance();

                        context.addMessage(null, fm);
                        e.printStackTrace();
                   
        }
    }


}





Monday, October 3, 2016

Write to File from init Bean ADF

  
Make sure you execute the view object & refresh the iterator before generate Print


  public void beforeGeneratePrint() {
        DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iter = bindings.findIteratorBinding("DynamicVO1Iterator");
        iter.executeQuery();

        System.out.println("get Estimated Row Count" + iter.getEstimatedRowCount());
}
---------------------------------------------------------------------------------------------------------------

  public void generatePrint() {
        FileOutputStream fop = null;
        File file;

        try {

          // file = new File("C://FileStore//quarter3Rpt.html");
            file = new File("//home//myapp//Attachments//quarter3Rpt.html");


       

            // if file doesnt exists, then create it
            if (!file.exists()) {
                file.createNewFile();
            }


            Map pageFlowScope = AdfFacesContext.getCurrentInstance().getPageFlowScope();
            Map sessionScope = ADFContext.getCurrent().getSessionScope();
            try {

                FileOutputStream fos = new FileOutputStream(file);
           
                OutputStreamWriter w = new OutputStreamWriter(fos);
                w.write("<html>");
                w.write("<head>");
                w.write("<style type=text/css>td{ font-family: Helvetica;font-SIZE: 11; } tr{ height: 18px; }</style>");
                w.write("</head>");
                w.write("<body>");
                //            w.write("<button onclick=\"myFunction()\">Print this page</button>");
                //            w.write("<script> function myFunction() { window.print();}</script>");
                w.write("<table>");
                w.write("<tr HEIGHT=18>");
                w.write("<td BGCOLOR=\"#FFFFCC\" COLSPAN=12 ALIGN=CENTER><b> " + this.getRptDesc() + "</b></td></tr>");

                //                      w.write("<td COLSPAN=6 ALIGN=RIGHT>Report Date: " +
                //                              new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date()) + "</td></tr>");

                w.write("<tr HEIGHT=18> <td  BGCOLOR=\"#FFFFCC\" COLSPAN=12 ALIGN=CENTER><b>  Company :" +
                        pageFlowScope.get("company") + " " + "Currency :" + sessionScope.get("currencyCode") +
                        " </b></td></tr>");
                w.write("<tr HEIGHT=18> <td COLSPAN=12 BGCOLOR=\"#FFFFCC\" ALIGN=CENTER><b> Period ending: " +
                        this.getPeriod() + "</b></td></tr>");

                w.write("<tr><td COLSPAN=12 BGCOLOR=\"#FFFFCC\" ALIGN=CENTER><b>Report Run Date: " +
                        new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date()) + "</b></td></tr>");


                //            HSSFWorkbook workbook = new HSSFWorkbook();
                //            HSSFSheet worksheet = workbook.createSheet("POI Worksheet");

                DCBindingContainer bindings =
                    (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
                DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("DynamicVO1Iterator");
                // HSSFRow excelrow = null;
                // Get all the rows of a iterator

                oracle.jbo.Row[] rows = dcIteratorBindings.getAllRowsInRange();

                int i = 0;


                for (oracle.jbo.Row row : rows) {
                    //print header on first row in excel
                    if (i == 0) {
                        //  excelrow = (HSSFRow) worksheet.createRow((short) i);
                        short j = 0;
                        w.write("<tr HEIGHT=21>");
                        for (String colName : row.getAttributeNames()) {
                            // HSSFCell cellA1 = excelrow.createCell((short) j);
                            if (!(colName.equalsIgnoreCase("SORT_ORDER") || colName.equalsIgnoreCase("P1"))) {
                                if (colName.contains("_")) {
                                    colName = colName.replace("_", " ");
                                    if (colName.toUpperCase().contains("PERCENT")) {
                                        colName = colName.toUpperCase().replace("PERCENT", "%");
                                    }
                                    if (j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")) {
                                        w.write("<th ALIGN=LEFT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " +
                                                colName + " </th>");
                                    } else {
                                        w.write("<th ALIGN=RIGHT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " +
                                                colName + " </th>");
                                    }
                                    //  cellA1.setCellValue(colName);
                                } else {
                                    // cellA1.setCellValue(colName);
                                    if (j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")) {
                                        w.write("<th ALIGN=LEFT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " +
                                                colName + " </th>");
                                    } else {
                                        w.write("<th ALIGN=RIGHT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " +
                                                colName + " </th>");
                                    }
                                }

                            }
                            j++;
                        }
                    }
                    w.write("</tr>");
                    //print data from second row in excel
                    ++i;
                    short j = 0;

                    w.write("<tr HEIGHT=18>");
                    for (String colName : row.getAttributeNames()) {


                        if (!(colName.equalsIgnoreCase("SORT_ORDER") || colName.equalsIgnoreCase("P1"))) {
                            if (row.getAttribute(colName) != null) {


                                if (j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")) {
                                    if (row.getAttribute(colName).toString().contains("_")) {


                                        w.write("<td  BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                row.getAttribute(colName).toString().replaceAll("_", " ") + "</td>");
                                    } else if (colName.equalsIgnoreCase("ACCOUNT")) {
                                        //numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US"));
                                        //  System.out.println("row.getAttribute(colName).toString()" +
                                        //   numberFormatter.format(row.getAttribute(colName)).toString());
                                        //  Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString())));
                                        System.out.println("this is the number" + row.getAttribute(colName));
                                        w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName) +
                                                "</td>");
                                    } else {
                                        w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName) +
                                                "</td>");
                                    }
                                }


                                else {

                                    // make sure the description doesnm't have any "_"
                                    if (row.getAttribute(colName).toString().contains("_")) {


                                        w.write("<td  BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" +
                                                row.getAttribute(colName).toString().replaceAll("_", " ") + "</td>");
                                    }

                                    // check if the String is a number; If so set the locale for positive no and for negative no. remove the - sign and enclose with in "( )"
                                    //For decimal numbers don't format it
                                    else if (this.isNumber(row.getAttribute(colName).toString().substring(1))) {
                                        if (row.getAttribute(colName).toString().contains("-")) {
                                            numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US"));
                                            //  System.out.println("------------------------------------" +
                                            //           numberFormatter.format(row.getAttribute(colName)).toString());
                                            //  Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString())));
                                            try {
                                                w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                        numberFormatter.format(row.getAttribute(colName)).toString().replace("-",
                                                                                                                             "(") +
                                                        ")" + "</td>");

                                            } catch (Exception e) {
                                                w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                        row.getAttribute(colName).toString().replace("-", "(") + ")" +
                                                        "</td>");
                                            }

                                        } else {
                                            if (colName.equalsIgnoreCase("ACCOUNT")) {
                                                //numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US"));
                                                //  System.out.println("row.getAttribute(colName).toString()" +
                                                //   numberFormatter.format(row.getAttribute(colName)).toString());
                                                //  Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString())));
                                                System.out.println("this is the number" + row.getAttribute(colName));
                                                w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" +
                                                        row.getAttribute(colName) + "</td>");
                                            }


                                            else {
                                                numberFormatter =
                                                    NumberFormat.getNumberInstance(new Locale("en", "US"));
                                                //System.out.println("row.getAttribute(colName).toString()" +row.getAttribute(colName).toString());
                                                try {

                                                    w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                            numberFormatter.format(row.getAttribute(colName)).toString() +
                                                            "</td>");
                                                } catch (Exception e) {
                                                    System.out.println("ctch blockkkkkkk" +
                                                                       row.getAttribute(colName).toString());

                                                    w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                            row.getAttribute(colName).toString() + "</td>");
                                                }
                                            }
                                        }
                                        //  cell.setCellValue("(" + row.getAttribute(colName).toString() + ")");

                                    }

                                    //In all other cases print the value as is
                                    else {
                                        if (row.getAttribute(colName).toString().contains(".")) {

                                            if (row.getAttribute(colName).toString().contains("-")) {
                                                numberFormatter =
                                                    NumberFormat.getNumberInstance(new Locale("en", "US"));

                                                w.write("<td   BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                        numberFormatter.format(row.getAttribute(colName)).toString().replace("-",
                                                                                                                             "(") +
                                                        ")" + "</td>");
                                            } else {
                                                w.write("<td  BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                        row.getAttribute(colName).toString() + "</td>");
                                            }
                                        } else {

                                            w.write("<td  BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" +
                                                    row.getAttribute(colName).toString() + "</td>");
                                            // cell.setCellValue(row.getAttribute(colName).toString());
                                        }
                                    }
                                }
                            } else {
                                w.write("<td  BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + " " + "</td>");
                                //cell.setCellValue("");
                            }
                        }


                        //                    System.out.println("colName " + colName + "row.getAttribute(colName).toString()" +
                        //                                       row.getAttribute(colName));


                        j++;
                    }

                    w.write("</tr>");

                }

                w.write("</table>");
                w.write("</body>");
                w.write("</html>");
                w.close();
            } catch (Exception e) {
                e.printStackTrace();
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fop != null) {
                    fop.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

Tuesday, September 6, 2016

Call a Java Servlet from JSP and pass a parameter to the Servlet from JSP

Register the servlet in the web.xml file

In the jsp file access the url to get the passed in parameter and pass it to the servlet

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
    <head>File Upload</head>
    <body>
        <form enctype='multipart/form-data' method='POST' action="/appSubmission/DataUpload">
            <p>
                <input type="file" name="test"/>
            </p>
            <!--<Parameter myparam: <%= request.getParameter("pUserId") %>  </parameter>-->
            <%

//request.setAttribute("pUserId", "8539");
String first = request.getParameter("pUserId");
session.setAttribute("pUserId",first);
%>
            <!--<p>
                ID: 
                <input type="text" name="p_user_id" value='<%=request.getParameter("pUserId")%>'/>
            </p>-->
            <p>
                <input type="submit" value="upload"/>
            </p>
      </form>
    </body>
</html>

Friday, September 2, 2016

Get Hostname, port no. & protocol from the http Servlet





    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

        doPost(req, res);
        System.out.println("APP-DEBUG: " + new Timestamp(date.getTime()) + " Leaving doGet()...");
    }

    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        System.out.println("APP-DEBUG: " + new Timestamp(date.getTime()) + " Entering doPost()...");
        // initialize variables and the servlet environment
        int i = 0;
        int lineNumber = 0;
        int errorCount = 0;
        Connection conn = null;
        res.setContentType("text/html");
        HttpSession session = req.getSession();
        System.out.println("Http Session................" + session.getAttribute("pUserId"));
        
        String userId = session.getAttribute("pUserId").toString();
        this.printMessage(req);
}



   public void printMessage(HttpServletRequest req) {

        // initialize variables for page attributes
        // these variables must match those set in apputil.stdhead to
        
         int httpPort = req.getServerPort();
        String serverHost = req.getServerName();
        String httpProtocol = req.getScheme();

System.out.println("httpPort"+httpPort+""+"serverHost "+serverHost+"httpProtocol "+httpProtocol );
}

Thursday, August 25, 2016

Print to HTML ADF

       
       
   <af:link text="Print" id="l1" icon="/resources/images/print.gif" partialSubmit="false"
                                 targetFrame="_blank" useWindow="true">
                            
                            <af:fileDownloadActionListener contentType="text/html"
                                                           filename="openPage.html"
                                                           method="#{pageFlowScope.rptsBean.generatePrint}"/>
                        </af:link>
       
public void generatePrint(FacesContext facesContext, OutputStream outputStream) throws IOException { Map pageFlowScope = AdfFacesContext.getCurrentInstance().getPageFlowScope(); Map sessionScope = ADFContext.getCurrent().getSessionScope(); try { OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-16"); w.write("<html>"); w.write("<head>"); w.write("<style type=text/css>td{ font-family: Helvetica;font-SIZE: 11; } tr{ height: 18px; }</style>"); w.write("</head>"); w.write("<body>"); // w.write("<button onclick=\"myFunction()\">Print this page</button>"); // w.write("<script> function myFunction() { window.print();}</script>"); w.write("<table>"); w.write("<tr HEIGHT=18>"); w.write("<td BGCOLOR=\"#FFFFCC\" COLSPAN=12 ALIGN=CENTER><b> " + this.getRptDesc() + "</b></td></tr>"); // w.write("<td COLSPAN=6 ALIGN=RIGHT>Report Date: " + // new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date()) + "</td></tr>"); w.write("<tr HEIGHT=18> <td BGCOLOR=\"#FFFFCC\" COLSPAN=12 ALIGN=CENTER><b> Company :" + pageFlowScope.get("company") + " " + "Currency :" + sessionScope.get("currencyCode") + " </b></td></tr>"); w.write("<tr HEIGHT=18> <td COLSPAN=12 BGCOLOR=\"#FFFFCC\" ALIGN=CENTER><b> Period ending: " + this.getPeriod() + "</b></td></tr>"); w.write("<tr><td COLSPAN=12 BGCOLOR=\"#FFFFCC\" ALIGN=CENTER><b>Report Run Date: " + new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date()) + "</b></td></tr>"); // HSSFWorkbook workbook = new HSSFWorkbook(); // HSSFSheet worksheet = workbook.createSheet("POI Worksheet"); DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("DynamicVO1Iterator"); // HSSFRow excelrow = null; // Get all the rows of a iterator oracle.jbo.Row[] rows = dcIteratorBindings.getAllRowsInRange(); int i = 0; for (oracle.jbo.Row row : rows) { //print header on first row in excel if (i == 0) { // excelrow = (HSSFRow) worksheet.createRow((short) i); short j = 0; w.write("<tr HEIGHT=21>"); for (String colName : row.getAttributeNames()) { // HSSFCell cellA1 = excelrow.createCell((short) j); if (!(colName.equalsIgnoreCase("SORT_ORDER") || colName.equalsIgnoreCase("P1"))) { if (colName.contains("_")) { colName = colName.replace("_", " "); if (colName.toUpperCase().contains("PERCENT")) { colName = colName.toUpperCase().replace("PERCENT", "%"); } if (j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")) { w.write("<th ALIGN=LEFT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " + colName + " </th>"); } else { w.write("<th ALIGN=RIGHT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " + colName + " </th>"); } // cellA1.setCellValue(colName); } else { // cellA1.setCellValue(colName); if (j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")) { w.write("<th ALIGN=LEFT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " + colName + " </th>"); } else { w.write("<th ALIGN=RIGHT BGCOLOR=\"#99CCCC\"><FONT COLOR=BLACK FACE=\"verdana\" SIZE=1 > " + colName + " </th>"); } } } j++; } } w.write("</tr>"); //print data from second row in excel ++i; short j = 0; w.write("<tr HEIGHT=18>"); for (String colName : row.getAttributeNames()) { if (!(colName.equalsIgnoreCase("SORT_ORDER") || colName.equalsIgnoreCase("P1"))) { if (row.getAttribute(colName) != null) { if(j < 2 || colName.equalsIgnoreCase("ACCOUNT_DESCRIPTION")){ if (row.getAttribute(colName).toString().contains("_")) { w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + row.getAttribute(colName).toString().replaceAll("_", " ") + "</td>"); } else if (colName.equalsIgnoreCase("ACCOUNT")) { //numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US")); // System.out.println("row.getAttribute(colName).toString()" + // numberFormatter.format(row.getAttribute(colName)).toString()); // Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString()))); System.out.println("this is the number" + row.getAttribute(colName)); w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName) + "</td>"); } else{ w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName) + "</td>"); } } else{ // make sure the description doesnm't have any "_" if (row.getAttribute(colName).toString().contains("_")) { w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName).toString().replaceAll("_", " ") + "</td>"); } // check if the String is a number; If so set the locale for positive no and for negative no. remove the - sign and enclose with in "( )" //For decimal numbers don't format it else if (this.isNumber(row.getAttribute(colName).toString().substring(1))) { if (row.getAttribute(colName).toString().contains("-")) { numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US")); // System.out.println("------------------------------------" + // numberFormatter.format(row.getAttribute(colName)).toString()); // Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString()))); try{ w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + numberFormatter.format(row.getAttribute(colName)).toString().replace("-", "(") + ")" + "</td>"); } catch(Exception e){ w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + row.getAttribute(colName).toString().replace("-", "(")+")" + "</td>"); } } else { if (colName.equalsIgnoreCase("ACCOUNT")) { //numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US")); // System.out.println("row.getAttribute(colName).toString()" + // numberFormatter.format(row.getAttribute(colName)).toString()); // Integer amountOut = new Integer(numberFormatter.format(Integer.parseInt(row.getAttribute(colName).toString()))); System.out.println("this is the number" + row.getAttribute(colName)); w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + row.getAttribute(colName) + "</td>"); } else { numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US")); //System.out.println("row.getAttribute(colName).toString()" +row.getAttribute(colName).toString()); try{ w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + numberFormatter.format(row.getAttribute(colName)).toString() + "</td>"); } catch(Exception e){ System.out.println( "ctch blockkkkkkk"+row.getAttribute(colName).toString()); w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + row.getAttribute(colName).toString() + "</td>"); } } } // cell.setCellValue("(" + row.getAttribute(colName).toString() + ")"); } //In all other cases print the value as is else { if (row.getAttribute(colName).toString().contains(".")) { if (row.getAttribute(colName).toString().contains("-")) { numberFormatter = NumberFormat.getNumberInstance(new Locale("en", "US")); w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + numberFormatter.format(row.getAttribute(colName)).toString().replace("-", "(") + ")" + "</td>"); } else { w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + row.getAttribute(colName).toString() + "</td>"); } } else { w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=RIGHT>" + row.getAttribute(colName).toString() + "</td>"); // cell.setCellValue(row.getAttribute(colName).toString()); } } } }else { w.write("<td BGCOLOR=\"#FFFFCC\" ALIGN=LEFT>" + " " + "</td>"); //cell.setCellValue(""); } } // System.out.println("colName " + colName + "row.getAttribute(colName).toString()" + // row.getAttribute(colName)); j++; } w.write("</tr>"); } w.write("</table>"); w.write("</body>"); w.write("</html>"); w.flush(); } catch (Exception e) { e.printStackTrace(); } }

Wednesday, July 20, 2016

Error: The file could not be uploaded because the file is too large ADF

https://community.oracle.com/thread/1776723?start=0&tstart=0


<context-param>
    <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
    <param-value>20480000</param-value>
  </context-param>