How to access java bean methods in applet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   joan_santos
Posted On:   Tuesday, September 23, 2003 11:46 PM

hi!


i'm new to java and i'm creating a jsp that uses a java bean and displays an applet. the java code for the applet needs to use methods defined in a bean. how can i do this?


thanks in advance!

Re: How to access java bean methods in applet

Posted By:   Stephen_McConnell  
Posted On:   Wednesday, September 24, 2003 05:06 AM

This seems to be a common question, but it stems from a miss-understanding of where parts of the total application execute.


The jsp is going to execute on the server side. All the beans and jsp's and servlets etc are going to be on the "server" side.


The Applet is going to execute on the client side in the client browser. Therefore, you do not have ready access to the "beans/objects" on the server side.


You can create a jar file just for your Applet that contains the classes you need from the server side. If you use Ant to build your web-application, you can re-build the jar file every time the bean changes, so the client is sure to get the correct class.


However, this does not give you access to "Objects" that exist on the server side. If you execute a jsp and a bean is in that JSP, it does not give you access to the information in that bean.


For that, you have to create some kind of protocol to allow the Applet to talk to the server and get that info through a connection to the server.


But that's another story...


Stephen McConnell

About | Sitemap | Contact