Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes EJB from HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB from HTML" Watch "EJB from HTML" New topic
Author

EJB from HTML

Simon Cockayne
Greenhorn

Joined: Dec 11, 2000
Posts: 5
Hello,

How can I invoke a session EJB from an HTML page?

Cheers,

Si.


Simon Cockayne
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Well, HTML is a static presentation language .... technically, it doesn't do anything. So, the question is, what can you embed in HTML that has the capability to interface with EJB ...


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Hello Simon Cockayne,
EJBs can only be invoked from a Java Application, be it a Servlet, JSP or simple StandAlone program. HTML is simple text file and can not invoke EJB.


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
Simon Cockayne
Greenhorn

Joined: Dec 11, 2000
Posts: 5
Hello,

Yes I should have been more specific. I attempted to imply that I have a HTML page (which cannot of itself invoke an EJB), moreover, the implication should have been, what can exist within an HTML page that can invoke an EJB. I.e. javascript or some other candidate.

I have seen examples of javascript being able to invoke an EJB, but only with Netscape, not Microsoft Internet Explorer. (Note I wish to use IE).

Additionally, I was under the impression that EJB's can also be invoked by non java applications. E.g. C++ and .NET I thought.

So, to recap. Given a HTML web page, how can I extend or enhance it, potentially through some embedded "non-html", such that an EJB can be invoked.

I am most grateful for your kind attention.

Kind regards,

Si.
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
I have seen examples of javascript being able to invoke an EJB, but only with Netscape, not Microsoft Internet Explorer. (Note I wish to use IE).

Here is an extract from Mastering EJB from Ed Roman

Understanding How to Call Beans
We now take a look at the other half of the world�the client side. We are now
customers of the beans� business logic, and we are trying to solve some realworld
problem by using one or more beans together. There are two different
kinds of clients.

Java RMI-IIOP based clients. These clients use the Java Naming and Directory
Interface (JNDI) to look up objects over a network, and they use the Java
Transaction API (JTA) to control transactions.

CORBA clients. Clients can also be written to the CORBA standard. This
would primarily be useful if you want to call your EJB components using
another language, such as C++. CORBA clients use the CORBA Naming
Service (COS Naming) to look up objects over the network, and they use
the CORBA�s Object Transaction Service (OTS) to control transactions.
Whether you�re using CORBA or RMI-IIOP, your client code typically looks
like this:
1. Look up a home object.
2. Use the home object to create an EJB object.
3. Call business methods on the EJB object.
4. Remove the EJB object.


So, to recap. Given a HTML web page, how can I extend or enhance it, potentially through some embedded "non-html", such that an EJB can be invoked.
You can have an applet in an HTML page which can theoratically invoke an EJB, but that is not recommended.
Normal practice is that HTML page calls a servlet on your web-server, and this servlet (which is a java program) invokes EJB.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


I have seen examples of javascript being able to invoke an EJB, but only with Netscape, not Microsoft Internet Explorer. (Note I wish to use IE).

Yeah?! You couldn't post one of these examples could you? Because thats
something I've never seen.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Simon Cockayne
Greenhorn

Joined: Dec 11, 2000
Posts: 5
This is an example of javascript calling EJB for netscape:

http://docs.sun.com/source/816-6120-10/ejbscrip.htm#522004

Cheers,

Simon.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Ah, you mean with serverside JavaScript. That makes sense now. You do realize that "Netscape" in this instance refers to Netscape Application Server (or iPlanet as its now known), not Netscape Internet Browser?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB from HTML