| Author |
Message |
|
|
Post subject: Applet CODEBASE
Posted: Apr 02, 2005 - 11:00 PM
|
|
Registered Member


Joined: Mar 25, 2005
Posts: 6
|
|
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 |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 04, 2005 - 04:29 AM
|
|
Registered Member

Joined: Jan 06, 2004
Posts: 23824
|
|
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. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 04, 2005 - 07:56 PM
|
|
Registered Member


Joined: Mar 25, 2005
Posts: 6
|
|
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 |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 04, 2005 - 08:11 PM
|
|
Registered Member

Joined: Jan 06, 2004
Posts: 23824
|
|
| 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. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 05, 2005 - 12:02 AM
|
|
Registered Member


Joined: Mar 25, 2005
Posts: 6
|
|
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 |
|
|
| |
|
|
|
 |
|
|
Post subject: What's the CODEBASE parameter
Posted: Mar 01, 2008 - 05:07 PM
|
|
Joined: Mar 01, 2008
Posts: 1
|
|
|
|
|
 |
|
|
Post subject:
Posted: Nov 15, 2008 - 08:05 PM
|
|
Registered Member


Joined: Oct 15, 2005
Posts: 212
|
|
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 |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: May 08, 2011 - 09:05 PM
|
|
Registered Member


Joined: Oct 15, 2005
Posts: 212
|
|
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 |
|
|
| |
|
|
|
 |
|
|