applet to servlet communication

applet to servlet communication

Post by Jeffrey Ho » Thu, 16 Sep 1999 04:00:00



I have an application that is using client side business objects written
in java, but not as applets...  they are just loaded into the html pages
with the applet tags, but they don't inherit the applet class...  I am
connecting to a database, right now through classes downloaded to the
client, and plan on moving them to servlets on the server, and need to
have a connection string that is machine specific...  I don't really want
to store any info on the client, and when I go to servlets, the only
thing that I need is the hostname of the server that the applet came
from...  I have thought of the following solutions, none of which are (in
my opinion...) great...

1)  Inherit applet for all the root classes...  problem with that is that
if I subclass applet, I will have to do it on pretty much all the
classes, at least those that do persistance...  

2)  Write a small class that subclasses applet and use it to get the host
name when needed from the other business classes...  at least that
eliminates the need to subclass applet all over the place...

3)  Pass in the string on the applet params...  really don't want to do
that one, since it would require using asp/php to write the proper
address on the fly, and that gets pretty messy...

Am I missing something EASY and straightforward, or how are others
solving the problem of connecting to a servlet in a client side class
without hardcoding the address...

Thanks for ideas in advance...

--
Jeffrey Hood
Senior Analyst
Norsoft, Inc.


 
 
 

applet to servlet communication

Post by Luke Webbe » Fri, 17 Sep 1999 04:00:00


Why not write an applet that loads your business object classes? That would
make for cleaner, simpler HTML and the code base and document base would
also be available. It also means you can use LiveConnect at need.

Luke


>I have an application that is using client side business objects written
>in java, but not as applets...  they are just loaded into the html pages
>with the applet tags, but they don't inherit the applet class
[snip]
>1)  Inherit applet for all the root classes...  problem with that is that
>if I subclass applet, I will have to do it on pretty much all the
>classes, at least those that do persistance...

>2)  Write a small class that subclasses applet and use it to get the host
>name when needed from the other business classes...  at least that
>eliminates the need to subclass applet all over the place...

[snip]

 
 
 

applet to servlet communication

Post by Timothy Falcon » Mon, 20 Sep 1999 04:00:00



says...

Quote:> I have an application that is using client side business objects written
> in java, but not as applets...  they are just loaded into the html pages
> with the applet tags, but they don't inherit the applet class...  I am
> connecting to a database, right now through classes downloaded to the
> client, and plan on moving them to servlets on the server, and need to
> have a connection string that is machine specific...  I don't really want
> to store any info on the client, and when I go to servlets, the only
> thing that I need is the hostname of the server that the applet came
> from...  I have thought of the following solutions, none of which are (in
> my opinion...) great...

> 1)  Inherit applet for all the root classes...  problem with that is that
> if I subclass applet, I will have to do it on pretty much all the
> classes, at least those that do persistance...  

> 2)  Write a small class that subclasses applet and use it to get the host
> name when needed from the other business classes...  at least that
> eliminates the need to subclass applet all over the place...

> 3)  Pass in the string on the applet params...  really don't want to do
> that one, since it would require using asp/php to write the proper
> address on the fly, and that gets pretty messy...

> Am I missing something EASY and straightforward, or how are others
> solving the problem of connecting to a servlet in a client side class
> without hardcoding the address...

> Thanks for ideas in advance...

I've done this using JSP & RMI.  JSP & servlets make it pretty easy to
use cookies to store session id's in the browser.  You can generate
connection params on the fly .. not at all messy.  I've used this
approach to go back and forth between servlets & applets using RMI.
 
 
 

1. Applet-Servlet communications

I want to use a POST method to transmit 6 items (variables) from an applet to a servlet without using RMI.

If you know a solution to this problem, please submit it http://www.the-codebook.com/show_code.asp?TopicId=6&ProblemId=769&Sub... here!

+++++++++++ Posted via The-Codebook.Com, The Source for Developers +++++++++++
http://www.The-Codebook.com/                      Java, VisualBasic, VisualC++

2. Sybase classes - opinions?

3. Servlet and Applet Communication

4. Oracle Programmer

5. Applet Servlet Communication in NES using Object Serialization

6. Alternatives to xp_cmdshell to launch a program

7. Problem with Applet Servlet communication

8. SQL equivalent to VB False?

9. http communication between applet and servlet

10. Communication Servlet-Applet

11. http communication between applet and servlet

12. Applet-Servlet Communications.