Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Servlet Question: What can they return to the caller?

Status
Not open for further replies.

Draug

Programmer
Apr 18, 2001
77
CA
Hi,

I have looked through as many threads as I can bear, and I still can't find a distinct answer to my question.

Can a servlet return a parameter, say a string variable? I have figured out they can return a file, but returning a string is what I am after. If they can return a variable, how do you get it to happen???

In case this matters, my servlet is called by javascript. The servlet creates an XML string, and it is this string that I wish to return to the javascript client.

Any insights are greatly appreciated. Thank - you.
 
Ok... I have a take on this.

Are you familiar with the XMLDOM provided by Microsoft?
It is available in IE5.x (maybe as a update for 4.x??).

There is a method called "load" in this api.

It loads an xml file... maybe if it takes urls (I can't remember???) then you could give it the url for the servlet that returns the xml string???

Sound good? Something you can use?

Do a search on msdn.microsoft.com for documentation.

Let me know if this was useful....



I hope this helped! ;-)
- Casey Winans
 
Thanks Casey.

The load method is what I will use. I can then use all of the DOM methods in my JavaScript.

Thanks so much for your advice!

Since you seem to know about XML... Is there a way I can do something similar that will work in Netscape? It is my understanding that XMLDOM only works in IE. How can I invoke a different parser in my script to replace the Microsoft implementation of the DOM? If I could do that, I could use the same scripts for Netscape and IE, which would be great.

Thanks again for your help.
 
I have no clue what you could do on the client side.

But if you do all your xml processing on the server-side using JSP and XML then you don't have to worry about what browser is being used.

I hope this helped! ;-)
- Casey Winans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top