this is my first post...not sure whats the problem...any suggestions would be appreciated...thanx

<%
int unViewedCt= 0;
out.write("var jsLeads = new Array);
(for (int i=0; i< leads.size(); i++) {
		              
currLead = (HashMap)leads.get(i);
		
						
out.write("jsLeads["+ i +"] = new Array();\n");
						
out.write("jsLeads[" + i + "][0] = '" + currLead.get("PK_LEADID") + "';\n");
						
out.write("jsLeads[" + i + "][1] = '" + currLead.get("CON_ID") + "';\n");
						
out.write("jsLeads[" + i + "][2] = " + currLead.get("BO_VISIBLE") + ";\n"); 
						
				
						
if (new Integer(currLead.get("BO_VIEWED").toString()).intValue() == 0 ) {
							
unViewedCt++;
						
}
		           
 }

<%}
%>

Recommended Answers

All 3 Replies

Not sure what the code is all about. If this code/question doesn't belong to Java am afraid this should not be in Java category.

Anyways, wherever your code belongs to, it has many syntax/ logical issues, did you try compiling it?

1. For loop starts with extra "(".
2. trying to fetch string out of hashMap currLead for key BO_VIEWED. This may lead to NPE, in case there is no value avilable for this key in your map.

If your code/ question belong to Web development please move your question and elaborate to help us help you :)

Thanks.

yeah that '(" is an error....yeah this is for web development...just thought it might have been something small I overlooked

Also, putting a null pointer check for the second statement as mentioned in my previous post would be better. If your problem is solved please mark this thread as solved, and please chose the category wisely in future. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.