MyEclipse: Applet CODEBASE

tadzio1 - Apr 02, 2005 - 11:00 PM
Post subject: Applet CODEBASE
Hi ,
I do not know what should be CODEBASE in the HTML code, generated by a servlet for an applet, which is coded under MyEclipse in the MyProject/src in a default package.

After deployment the class file of the applet is visible on a server ( like Tomcat 5 ) as:
webapps/MyProject/WEB-INF/classes/MyApplet.class , but I cannot guess what CODEBASE in the HTML code should be.
As an example consider the following code snippet of
http://servlets.com/jservlet2/examples/ch10/ChatDispatch.java
=========
// Print the HTML code to generate the applet.
// Choose the applet code based on the method parameter.
// Provide a user parameter if we know the remote user.
out.println("<APPLET CODE=" + applet + " CODEBASE=/ " +
"WIDTH=500 HEIGHT=170>");
==========
In the above snippet the command:
" CODEBASE=/ " does not work
and
" CODEBASE=WEB-INF/classes "
does not work - the applet is not loaded to the browser.
I tried also simpler applets than HttpChatApplet ( of the above example) , but without success.
Is it OK to keep the applet class file in the WEB-INF/classes , if not - where and how to put it ? And what about CODEBASE ?
Tad
support-rkalla - Apr 04, 2005 - 04:29 AM
Post subject:
Moving to OT > Soft Dev, this is not an ME issue.


Tad, CODEBASE is just where the applet code lives, and it *must* be in a publically accessible place. Anything under WEB-INF is actually protected by the app server and not publically accessible, so that won't work. Try and put the class somewhere that you can actually hit the class file with your browser, once you've done that, just type in the whole path for the codebase, like:
CODEBASE=http://www.mydomain.com/applet/code

And then have your class files in the code directory.
tadzio1 - Apr 04, 2005 - 07:56 PM
Post subject:
Thanks, Riyad
Now it is clear. One more newbie question:
Can I configure the build method - using only myEclipse menu - to automatically compile a selected source folder ( /applet_src ) to the /applet/code/applet.jar outside WEB-INF , as the regular src folder is automatically compiled inside WEB-INF .
Of course I may do it using Ant, but ... it is great in MyEclipse, that we do not need to use Ant !
Tad
support-rkalla - Apr 04, 2005 - 08:11 PM
Post subject:
Quote:

Can I configure the build method - using only myEclipse menu - to automatically compile a selected source folder ( /applet_src ) to the /applet/code/applet.jar outside WEB-INF , as the regular src folder is automatically compiled inside WEB-INF .

I think you can also play with the File > Export > To JAR feature of Eclipse, that might do the trick too.
tadzio1 - Apr 05, 2005 - 12:02 AM
Post subject:
Thanks for the trick.
I found also that it makes more sense to keep all the "applet source" in a seperate Java (not WEB ) project, with an output to the jar file.
Tad
dejan.ristov - Mar 01, 2008 - 05:07 PM
Post subject: What's the CODEBASE parameter
Hi,
I have the same problem with the same class :
http://servlets.com/jservlet2/examples/ch10/ChatDispatch.java

Can you tell me what did you write in the CODEBASE parameter ?
amir55 - Nov 15, 2008 - 08:05 PM
Post subject:
hi Dear Riyad and all

1 - I have my codebase in the jsp as to refer to java class in com.corejsf package

I exported this class to a jar to place in the lib

my jsp applet related source as next

<jsp:plugin type="applet" code="English.class" codebase="com/corejsf/" width="475" height="350">
</jsp:plugin>


so the question how to access this applet using he codebase ?

2 - more to ask If I prefer NOT to keep the java applet in a jar so how to access it while Myeclipse automatically place classes in the WEB-INF ?

many thanks
Amir
amir55 - May 08, 2011 - 09:05 PM
Post subject:
hi again

still no one has yet replied to my question to how to use the codebase in jsp to access the applet in side a pckage in the src

thnaks allot

Amir
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits