Kaleb Gary

Greenhorn
+ Follow
since Nov 14, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kaleb Gary

Not quite sure what you're looking for, but you could use an iterator to cycle over the elements and get them out.




More info here...
18 years ago
A HashSet should work fine. Simply when you try to add the object check the boolean that is returned. It will return false if it already exists.

For more info:

Set Interface Information
18 years ago
Hmmm...

You could use nested for loops.

I've done something similar - and had it work. Simply create use the inner for loop to print out the records to the row. In the outer for loop to add a new row.

[ November 29, 2005: Message edited by: Caleb McGary ]
[ November 29, 2005: Message edited by: Caleb McGary ]
18 years ago
JSP
I've tried setting the innerHTML tag to the jsp , but it doesn't compile the jsp so all I get is the jsp code, not html.

The webResponse allows setting of content and text, but I can't get it to pull the html output from the jsp. Simply lack the knowledge of how to do it.

The javadocs don't seem to offer any additional information. Also tried using a jsp to dynamically create the javascript. Got the furthest with this one, but not sure of how to get the bean data to the javascript.

The above code is what should work, or so it seems from other information that I've got - but I don't know what to do next.
I am using JavaScript to grab information from several textfields on a main html page and post it to a J2EE servlet which queries a database. The response from the database is returned in the form of a bean. This bean is then attached to the request, and sent off to a jsp. The jsp dynamically displays the results based on the information in the bean.

So the question is this:

Is there a way I can get the html that is generated by the jsp and somehow use it to dynamically update the main html page (in the servlet or by using javascript)?

<code snippet of javascript>

//req is XMLHttpRequest

function sendRequest()
{
var url = "/crmcgary/Control?";
var fname = document.getElementById('fname').value;
var lname = document.getElementById('lname').value;
if(req == null)
req = getRequest();
req.open("GET", url + "&fname=" + escape(fname)+ "&lname=" + escape (lname) + "&flag=true" , true);
req.onreadystatechange = updateNamesDiv();
req.send("");
}

function updateNamesDiv()
{
var bodyTag - document.getElementById('mainBody');
bodyTag.innerHTML = req.responseText;

//responseText needs to equal html that is generated by jsp
//possible?

}

<end code>

I don't need code (cause I'm not sure I'm going to do this). I simply need a general direction to go in.