applet, ejbs and MVC

T

Taki

Hi,

I am having a trouble with designing my application.
I am new to EJBs, so maybe this is a trivial question, but
I want applets to access EJBs. I believe EJBs are models in MVC.
Applets are like views. I know servlets are controllers, but since
I'm skipping servlets and accessing EJBs directly from applets, what
should be controllers in this kind of architecture?

Also, if someone can give me advantages and
disadvantages of applets accessing EJBs (over applets->servlets->EJBs),
I would appreciate it.

BTW, I don't have an option to use JSP instead of applets because of
the need of a rich client-side view.

Thanks in advance

Taki
 
A

Ashton

Taki said:
I know servlets are controllers, but since
I'm skipping servlets and accessing EJBs directly from applets, what
should be controllers in this kind of architecture?

What are you using as a server? What are you using as an EJB container?
Are your applets going to communicate via HTTP? If not, how will the
applets encode/decode data to be transferred?

Without getting too hung up on MVC stuff, you need something that's
listening for whatever your applet is sending and (probably) returning a
response. That could be your own server socket code or a "real"
server...like Tomcat. Of course, at that point, why not use
servlets...they already have a protocol for reading parameters from HTTP
requests and doing client I/O.
 
T

Taki

Ashton said:
What are you using as a server? What are you using as an EJB container?
Are your applets going to communicate via HTTP? If not, how will the
applets encode/decode data to be transferred?

I am thinking about using JBoss+Tomcat.
Without getting too hung up on MVC stuff, you need something that's
listening for whatever your applet is sending and (probably) returning a
response. That could be your own server socket code or a "real"
server...like Tomcat. Of course, at that point, why not use
servlets...they already have a protocol for reading parameters from HTTP
requests and doing client I/O.

Yes, using Tomcat would be nice. But then, whenever an applet needs to
talk to Tomcat, it needs to construct an html file, right? It seems like a
lot
of work just to access to Tomcat. Also, I want Tomcat to return an object
to an applet as a response. I don't know how this is possible since Tomcat
has to send an html back to the applet. Is it possible, and if it is, how
can
I implement that?

Thanks in advance

Taki
 
M

Michael N. Christoff

Taki said:
I am thinking about using JBoss+Tomcat.


Yes, using Tomcat would be nice. But then, whenever an applet needs to
talk to Tomcat, it needs to construct an html file, right? It seems like a
lot
of work just to access to Tomcat. Also, I want Tomcat to return an object
to an applet as a response. I don't know how this is possible since Tomcat
has to send an html back to the applet. Is it possible, and if it is, how
can
I implement that?

Thanks in advance

As to the implementation : If you're using EJB, just use RMI to access it
from the applet (using the standard EJB way. Check any EJB sample code for
an idea). This will be a lot faster than using html. Also, if needed, you
could program a stateful protocol using stateful Session beans. HTML is
stateless by default. RMI also has the benfefit of being to transport
actual Java objects. Just make sure you read the jboss docs on which jboss
jars will be needed on the client. Use one of those programs that inspects
your applet source and generates a minimal jar.

I have written client code that access EJB's. Its quite straight forward.



l8r, Mike N. Christoff
 
T

Taki

As to the implementation : If you're using EJB, just use RMI to access it
from the applet (using the standard EJB way. Check any EJB sample code for
an idea). This will be a lot faster than using html. Also, if needed, you
could program a stateful protocol using stateful Session beans. HTML is
stateless by default. RMI also has the benfefit of being to transport
actual Java objects. Just make sure you read the jboss docs on which jboss
jars will be needed on the client. Use one of those programs that inspects
your applet source and generates a minimal jar.

I have written client code that access EJB's. Its quite straight forward.



l8r, Mike N. Christoff

Hi,

Thank you for your advice. I think I'll implement this using RMI. I have a
question,
though. What do you mean by "a stateful protocol using stateful Session
beans"?

Also, is it better to use RMI over SSL? I know that without SSL, it's not
secure;
what could happen if a socket is not secure (i.e., what could hackers (or
someone else)
do to the server?)? I'm not familiar with security or what people are
capable of,
but I'm willing to learn and use SSL if the server could be in danger of
getting harsh attacks:)

Thanks a lot in advance

Taki
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top