The task assigned to me is something like this. I have read the contents of an XML document and display the contents on the webpage. I chose applet for doing this task. I had successfully created a class which will read XML doc and an applet for display the contents one by one. When viewed in the applet viewer everthing is working fine.
But when started viewing the same in a browser after adding the code for viewing the same through an html / jsp file. I do not see the same output as viewed through an applet veiwer.
Then i thought the issue may be of calling the other classes required for execution of the applet (XML reader Class), then i transfered the code for reading the XML file inside the applet itself with out any joy.
Presently the .class file, the html, XML file and the jsp are in the same location. The XML file is in the server location and i am using URL and input stream for getting the file from the server to applet
The follwing are the codes as it is in my test condition
binu narayanan wrote:I do not see the same output as viewed through an applet veiwer.
This appears to be the entire description of your problem. (If there was more buried in that dump of code, I apologize for overlooking it.) Could you possibly expand it into something which tells us what the problem is?
When i run the applet in applet viewer, iam able to see the output as it should be i.e. i get the see the output from the xml file in the applet. But while i run the applet in the browser be it Internet eplorer or Mozilla i do not get the output from the XML but get to see the panels and buttons which are available in the applet.
I see. So the applet does appear, and the GUI looks normal? Is there a button which you click to display the XML document? If so, then what happens when you click it?
(I'm asking these questions because I haven't really read your code. All of the apparent code which turned out to be comments was very distracting, and the random indenting of lines was distracting too.)
Anyway, does the Java console have error messages in it when that happens? The usual problem with beginners to applet writing is that they don't realize that a File object refers to a file on the system where the applet is running and not to a file on the server where the applet was downloaded from. I did see a reference to a File in your code, then I saw it was commented out.
When the applet appears be it in applet viewer or in the browser i click on a button labeled start-- button name is btnStart. upon its click i start the XML read operation and set the textbox value to the value obtained from the XML. Moreover i have an image in the xml in the binary format which also gets displayed.
This is basic opertaion i intend to do.
While these are happening in the applet viewer. The same result is not achieved in the browser.
You are correct in pointing out , i had initially used the file option to get the XML doc, which will not server the purpose while renderig through a browser.
I am sorry about the codes i had postednot in a formatted way.
Your further help will surely sail me through this
binu narayanan wrote:While these are happening in the applet viewer. The same result is not achieved in the browser.
That isn't much help. If you want help with your problem you need to provide a description of the problem. All we know so far is what didn't happen. That leaves open the question of what did happen instead, which is important information.