Friday, July 17, 2015

Dump variables

If you want to know what all variables are present on a particular webpage, you can run the following code to find all the available variables.

<%
Enumeration e = ics.GetVars();
while ( e.hasMoreElements() )
{
String varName = (String)e.nextElement();
String varValue = ics.GetVar(varName);
out.println("Name: "+varName +" & Value:"+ varValue +"<br/>");
}
%>

If you want to know what are columns and values present in an IList


<%
StringBuffer iListTable= new StringBuffer();
IList tmp = ics.GetList("listname");
if (tmp!=null && tmp.hasData()){
int cols = tmp.numColumns();
iListTable.append("<table>");
//Column Names
for (int x = 0;x<cols;x++){
iListTable.append("<th>"+tmp.getColumnName(x)+"</th>");
}
iListTable.append("<tr>");
//Column Values
do {
for (int y = 0;y<cols;y++){
iListTable.append("<td>"+ tmp.getValue(tmp.getColumnName(y)) +"</td>");
}
}
while(tmp.moveToRow(IList.next, 0));
}
iListTable.append("</table>");
out.print(iListTable.toString());
%>
Disclaimer: Any sample code on this blog is not officially recommended, use at your own risk.

No comments:

Post a Comment

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...