DOM API or LiveConnect?

D

DKM

I have just figured out how to use LiveConnect to use Javascript from
inside an Java Applet. I am doing this to dynamically generate HTML
elements. Previously, I was able to do all that using Javascript only,
no Java Applet and such. The project is going to be large and I did not
want to do all the coding in Javascript. After enquiring a bit here, I
found LiveConnect is the solution.

Now, I also find something called DOM API. My question is this. Can DOM
API be used to dynamically create XHTML elements and if so is it more
suitable than LiveConnect to dynamically create XHTML elements?

Thanks in advance.

D.K. Mishra
 
A

alan

I have just figured out how to use LiveConnect to use Javascript from
inside an Java Applet. I am doing this to dynamically generate HTML
elements. Previously, I was able to do all that using Javascript only,
no Java Applet and such. The project is going to be large and I did not
want to do all the coding in Javascript. After enquiring a bit here, I
found LiveConnect is the solution.

Now, I also find something called DOM API. My question is this. Can DOM
API be used to dynamically create XHTML elements and if so is it more
suitable than LiveConnect to dynamically create XHTML elements?

Yes. Using the DOM API you can create XHTML content and insert
it into a document causing the page to change immediately.

You can also obtain XHTML content in DOM format using the
HttpXMLRequest object in today's browsers.

You can google for AJAX to read more about this form of UI
programming. Or try...

http://www.ajaxpatterns.org/index.php?title=Main_Page

I don't know if this is a good resource, I simply came across it
recently, but it should be a place to start.
 
D

DKM

Yes. Using the DOM API you can create XHTML content and insert
it into a document causing the page to change immediately.

Thank you. Thats what I was thinking. Time to take a good look at the
DOM API. Having searched the web, I have not come across any good short
examples to explain the basics. The short example at Sun explains how
to get and set the document title.
You can also obtain XHTML content in DOM format using the
HttpXMLRequest object in today's browsers.

You can google for AJAX to read more about this form of UI
programming. Or try...

http://www.ajaxpatterns.org/index.php?title=Main_Page

The above site is hard to browse, you click a link and it thinks you
want to edit the page or something. But, I read a nice article which
explains what it is all about. It explains how the same idea is used to
display maps at Google. I had never tried the maps at Google. It sure
is a nice application.
I don't know if this is a good resource, I simply came across it
recently, but it should be a place to start.

Interesting site. Worth visiting again and again. AJAX, interesting
acronym. I was looking at DOM API documentation site at SUN and I
notice that Sun calls related technologies JAX this or JAX that as in
JAXB (binding), JAXR (registering), JAXP (processing). The maps in
Google must be using JAX-RPC or SAAJ (SOAP).

Thanks for the reference.

D.K. Mishra
 
M

Martin Honnen

DKM said:
I have just figured out how to use LiveConnect to use Javascript from
inside an Java Applet. I am doing this to dynamically generate HTML
elements. Previously, I was able to do all that using Javascript only,
no Java Applet and such. The project is going to be large and I did not
want to do all the coding in Javascript. After enquiring a bit here, I
found LiveConnect is the solution.

Now, I also find something called DOM API. My question is this. Can DOM
API be used to dynamically create XHTML elements and if so is it more
suitable than LiveConnect to dynamically create XHTML elements?

I have yet to see a working solution using the DOM API from inside an
applet to change the DOM of the HTML document the applet is in, the API
is part of the SUN Java API/SDK since 1.4 but even with 1.5 I am not
sure it works. Thus you are much better off using LiveConnect and doing
the DOM programming with JavaScript.
 
D

DKM

Martin said:
I have yet to see a working solution using the DOM API from inside an
applet to change the DOM of the HTML document the applet is in, the API
is part of the SUN Java API/SDK since 1.4 but even with 1.5 I am not
sure it works. Thus you are much better off using LiveConnect and doing
the DOM programming with JavaScript.

LiveConnect works but it is of limited capability. One can change
existing text value and styles using LiveConnect. So, one can update a
table with initial matrix values. But, one can not create new table or
new anything and expect LiveConnect to survive a page refresh.

I have come accros hundreds of messages and articles and bug reports
about this in the newsgroup archives and also in Sun's web site. Sun
claims to have fixed such bugs, but I suppose the bug lies in the
netscape packages and Sun has no permission to fix the netscape
packages.

I have posted the source codes in another message titled "LiveConnect
Applet crashes on page reload", please take a look and let me know if
anything wrong in it. The applet works in IE 6.0 and FireFox 1.4, but
IE crashes eventually, Firefox crashes only under certain condition.

I don't know where to begin if I want to try out DOM API. What do I
need to install, where do I find them and such. Again, examples are
hard to find anywhere.

Thanks very much in advance.

D.K. Mishra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top