Source code for /src/table.jsp.txt

//======================================================================//
// Author: Mark Qian <markqian@hotmail.com>                             //
// WWW: http://www.coolshare.com                                        //
// Copyright (c) 2006, Mark Qian                                        //
//                                                                      //
// You must contact Mark Qian to get a permission of use                //
// in case you want to make any use of the codes except viewing it     //
// on Mark's site.                                                      //
//======================================================================//


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.lang.StringBuffer"%>
<%@ page import="java.util.List" %>
<%@ page import="javax.servlet.http.Cookie" %>
<%@ page import="com.coolshare.remotescript.common.Util" %>

<%
  List items = (List)request.getAttribute("NEW_ITEMS");
  String a = request.getParameter("a");
  String cId = request.getParameter("cId");
  String res = "";
  if (items.size()>0) {
	  String[] row = (String[])items.get(0);
	  res += Util.doEncode(row[0]);
	  for (int j=0; j<row.length; j++) {
		  res +=  "<"+Util.doEncode(row[j]);
	  }
	  
	  for (int i=1; i<items.size(); i++) {
		  row = (String[])items.get(i);
		  res += ">";
		  res += Util.doEncode(row[0]);
		  for (int j=1; j<row.length; j++) {
			  res += "<"+Util.doEncode(row[j]);
		  }
	  }
  }
  
if (a.equals("AJAX")) {
%>
<%=res%>
<%
} else if (a.equals("DS")) {
%>
var comm = cm.findCommunicator('<%=cId %>');
comm.res = "<%=res%>";
comm.process();
<%
} else if (a.equals("Iframe")) {
	%>
	<html>
	  <script>
	  function doOnload() {
	    try {
		  var comm = parent.cm.findCommunicator('<%=cId %>');
		  comm.res = "<%=res%>";
		  comm.process();
		} catch (e) {
		  var msg = e.description?e.description:e;
          alert(msg);
          if (msg=="Permission denied")
            alert("Sorry, I, the code from RemoteScript.com, can not close the progress dialog\nsince it is popped up codes from coolshare.com .");
        }
	  }
	</script>
	<Body onload="doOnload()">
	</Body>
	</html>
<%
}
else if (a.equals("Cookie")) {
  Cookie setCookie = new Cookie("RSLite", res);
  response.addCookie(setCookie);	
}
else if (a.equals("Frame")) {
	%>
	 <html>
  <script>
  function doOnload() {
    try {
	  var comm = top.main.cm.findCommunicator('<%=cId %>');
	  comm.res = "<%=res%>";
	  comm.process();
    } catch (e) {
       alert(e.description?e.description:e);
       alert("Sorry, I, the code from RemoteScript.com, can not close the progress dialog\nsince it is popped up codes from coolshare.com .");
    }
  }
</script>
<Body onload="doOnload()">
</Body>
</html>
<%
	}
%>