<%@ page import="java.io.*,java.net.*,java.util.*,java.net.URL,java.net.URLEncoder,java.net.URLDecoder,java.io.File" %> <% //response.setHeader("Connection","close"); String ubcode = "UB_CODE"; String line; String templateFile; String group = request.getParameter("gr"); String groupid = request.getParameter("id"); //String s = "/usr/local/jrun/ubgroups/groups.txt"; String lang = request.getParameter("l"); //check for parameters if(groupid==null){////groupid groupid="z9000"; group=" "; } if(group==null){ group = " "; groupid = "z9000"; } if(lang==null) { lang="en"; } // if(groupid.equals("z9000")) // templateFile = "http://www.ultrabrowser.com/gtemp/a_7000"; // else templateFile = "/home/webadmin/ultrabrowser.com/html/gtemp/" + groupid + ""; File testFile = new File (templateFile); if(!testFile.exists()) templateFile = "/home/webadmin/ultrabrowser.com/html/gtemp/z9000"; String name = URLEncoder.encode(group); if(name.equals(" ")){ name = "UB"; } request.setAttribute("groupid", groupid); request.setAttribute("group", group); request.setAttribute("name", name); try { //File f = new File (templateFile); //if(!f.exists()) // f = new File ("/home/webadmin/ultrabrowser.com/html/gtemp/z9000"); FileInputStream fis = new FileInputStream(templateFile); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); while ((line = br.readLine()) != null){ int start = line.indexOf(ubcode); if(start==-1){ out.println(line); } else { out.println(line.substring(0,start)); %> <% if(lang.equals("fr")) {%> <%@ include file="fr_core.html" %> <% } else if(lang.equals("it")) { %> <%@ include file="it_core.html" %> <% } else if(lang.equals("de")) { %> <%@ include file="de_core.html" %> <% } else if(lang.equals("es")) {%> <%@ include file="en_core.html" %> <% } else {%> <%@ include file="en_core.html" %> <% } out.println(line.substring(start+7)); } } } catch (Exception exception) {out.println("Error in templatefile try block....
" + exception);} // try{ // URL url = new URL(templateFile); // URLConnection con = url.openConnection(); // con.connect(); // String headerfield = con.getHeaderField(0); // // if(headerfield.indexOf("404")!=-1){ // templateFile = "http://www.ultrabrowser.com/gtemp/z9000"; // } // } catch (Exception ex){} // try{ // URL url1 = new URL(templateFile); // URLConnection con1 = url1.openConnection(); // con1.connect(); // InputStream is = con1.getInputStream(); // InputStreamReader isr = new InputStreamReader(is); // BufferedReader br = new BufferedReader(isr); // while ((line = br.readLine()) != null){ // int start = line.indexOf(ubcode); // if(start==-1){ // out.println(line); // } else { // out.println(line.substring(0,start)); %>