<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import="java.io.*"%> <%@page import="com.massins.XMLTransform"%> <%! private static String readFile(String filename) throws IOException { String lineSep = System.getProperty("line.separator"); BufferedReader br = new BufferedReader(new FileReader(filename)); String nextLine = ""; StringBuffer sb = new StringBuffer(); while ((nextLine = br.readLine()) != null) { sb.append(nextLine); // // note: // BufferedReader strips the EOL character. // sb.append(lineSep); } return sb.toString(); } %> <% String template = "/home/massins2/public_html/template.html"; // template file name String top_menu_item = request.getParameter("top_menu"); String context_menu_item = request.getParameter("context_menu"); if (top_menu_item == null) top_menu_item = ""; if (context_menu_item == null) context_menu_item = ""; String context_menu_file = ""; String body_text_file = ""; if (top_menu_item.equals("bt_products")){ context_menu_file="/home/massins2/public_html/template_products_menu.html"; if (context_menu_item.equals("cm_image")) body_text_file = "/home/massins2/public_html/top_products/products-image.html"; else if (context_menu_item.equals("cm_rmv")) body_text_file = "/home/massins2/public_html/top_products/products-rmv.html"; else if (context_menu_item.equals("cm_comm_auto")) body_text_file = "/home/massins2/public_html/top_products/products-comm_auto.html"; else if (context_menu_item.equals("cm_service")) body_text_file = "/home/massins2/public_html/top_products/products-service.html"; else /* ($context_menu_item == "cm_accelerator") */ body_text_file = "/home/massins2/public_html/top_products/products-accel.html"; } else if (top_menu_item.equals("bt_contact")){ context_menu_file="/home/massins2/public_html/template_contact_menu.html"; if (context_menu_item.equals("cm_email")) body_text_file = "/home/massins2/public_html/top_contact/contact-email.html"; else if (context_menu_item.equals("cm_our_team")) body_text_file = "/home/massins2/public_html/top_contact/contact-team.html"; else /*if ($context_menu_item == "cm_common")) body_text_file = "/home/massins2/public_html/top_contact/contact-common.html"; else /*if ($context_menu_item == "cm_test") */ body_text_file = "/home/massins2/public_html/top_contact/contact-common.html"; } else if (top_menu_item.equals("bt_faq")) { context_menu_file="/home/massins2/public_html/template_faq_menu.html"; body_text_file = "/home/massins2/public_html/top_faq/faq.html"; } else if (top_menu_item.equals("bt_jobs")) { context_menu_file="/home/massins2/public_html/template_jobs_menu.html"; body_text_file = "/home/massins2/public_html/top_jobs/jobs.html"; } else /* ($top_menu_item == "bt_about")*/ { context_menu_file="/home/massins2/public_html/template_about_menu.html"; if (context_menu_item.equals("cm_news")) //body_text_file="/home/massins2/public_html/top_about/about_news.html"; body_text_file="news"; else /* if (context_menu_item == "cm_about") */ body_text_file="/home/massins2/public_html/top_about/about_us.html"; } //out.print(context_menu_file+"\n"+body_text_file); // ----------------------------------------------------------------------------------------- String template_contents = ""; String context_menu_contents = ""; String body_text_contents = ""; try { template_contents = readFile(template); context_menu_contents = readFile(context_menu_file); if (!body_text_file.equals("news")) body_text_contents = readFile(body_text_file); else { try { body_text_contents = XMLTransform.DoTransform("/home/massins2/public_html/top_about/news.xml", "/home/massins2/public_html/top_about/news.xsl"); } catch (Exception e) {body_text_contents = e.getMessage();} } }catch (IOException ee) {body_text_contents = ee.getMessage();} //out.print(context_menu_contents); template_contents = template_contents.replaceAll("_k_ContextMenu",context_menu_contents); template_contents = template_contents.replaceAll("_k_PageBody",body_text_contents); out.print(template_contents); //out.print( get_page(template, context_menu_file, body_text_file)); %>