• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet and XML Doc through a browser

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Every body,

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

Mixed.Java


This is code for the html file



This is the code for jsp file



The Java console output is some thing like this



Your guidance would be of immense help to me.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
binu narayanan
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi every body,

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 hope your guidance could solve the issue.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
binu narayanan
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

I hope you are not offend by this addressing.

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
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

The following is the out put in the Java Console

 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
binu narayanan
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

I had explained what happens, like i have a start and stop button. The start button initiates the process opf reading a XML and displaying the contents to the applet.

I am attaching two screen shots to show what happens when the start button is clicked in the applet viewer and the browser


Binu
browseroutput.jpg
[Thumbnail for browseroutput.jpg]
This is browser output
appletoutput.jpg
[Thumbnail for appletoutput.jpg]
This is applet output
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see this is an Applet and not a JApplet. Why?
 
binu narayanan
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Does having this in Japplet carry any added advantage. Kindly enumerate.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic