How to access applets?

I created an applet with JSC2 and want to include it a page fragment so i can embed that page fragment in other pages.

The applet is one that I created earlier in jbuilder and it ran fine.

I created an applet in JSC and copied the code.

The only modification I made was to remove the jbinit() method which was empty anyway.

My page fragment looks like this

<?xml version="1.0" encoding="UTF-8"?>

<div style="height: 490px; width: 320px; -rave-layout: grid" xmlns:f="http://java.sun.com/jsf/core">

<f:subview id="AppFrag"/>

<APPLET CODE="MyApplet.class" WIDTH="320" HEIGHT="490">

</APPLET>

</div>

When I try to run the project, I get an"Applet MyApplet notinited" error.

I suspect the only problem is that I have given an incorrect reference in the

<APPLET> tag.

I tried adding the package reference just in case that was needed, but the same problem.

Has anyone created an applet in JSF and had it successfully run?

If so, how have you refered to the applet in the calling page?

[1161 byte] By [BeaverCleaver] at [2007-11-26 7:43:17]
# 1
Take a look at this: http://blogs.sun.com/torAnd search down to an entry called "Applets in your webapps" posted on Tuesday March 14, 2006
lowec at 2007-7-6 19:52:32 > top of Java-index,Development Tools,Java Tools...
# 2
And this tutorial by the man himself has just appeared: http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/appl et.html
lowec at 2007-7-6 19:52:32 > top of Java-index,Development Tools,Java Tools...
# 3

Interisting one on using the static text component.

However, using the <applet> tag in a jsp page should be adequate.

The problem I am having is what to I need for the CODEBASE attribute in the applet tag for an applet that was created within JSC2?

<APPLET

CODEBASE="?"

CODE="MyApplet.class"

WIDTH="320"

HEIGHT="490">

</APPLET>

It appears that MyApplet.class is in the ./WEB-INF/classes/ direcory.

However, when I tried using that for the CODEBASE, it did not work.

The question now becomes - am I pointing to the correct location or am I having problems with the code?

I'm pretty sure the applet should work.

It was working in another IDE.

So, I am left with the assumption that I am not pointing to the correct place.

BeaverCleaver at 2007-7-6 19:52:32 > top of Java-index,Development Tools,Java Tools...
# 4

OK, I think I know the problem

I created a jar file of the applet with JBuilder and found out it has to be signed before I could run it in a browser.

I can add the signed applet jar file to my JSC project and things work OK.

The problem is I would rather not have to do it that way if possible.

Does anyone know if there is a way to "Sign" the class within my JSC2

project rather than create an external jar file?

BeaverCleaver at 2007-7-6 19:52:32 > top of Java-index,Development Tools,Java Tools...
# 5
Signing an applet requires that the code be place in a jar file, since the jar is what contains the "signature" files.See the Java documentation concerning the jarsigner tool.
ChuckBing at 2007-7-6 19:52:32 > top of Java-index,Development Tools,Java Tools...