Wie muss der Pfad beim CODEBASE aussehen, wenn ich ein Applet in JSP einbinden möchte.
Announcement
Collapse
No announcement yet.
Applets in JSP
Collapse
X
-
Hi,
<p>die CODEBASE gibt optional ein Dir. an, von dem das Applet geladen werden soll. Der default ist immer das Dir. in dem die HTML-Seite bzw. JSP steht. Es geht also auch ohne CODEBASE, wenn JSP und Applet.class im gleichen Dir. stehen.
<pre>
<%-- Die JSP liegt in %TOMCAT_HOME%/webapps/<app>/jsp --%>
<html>
<head>
<title>LoadApplet.jsp</title>
</head>
<body bgcolor="beige">
<h1>LoadApplet.jsp</h1>
<h3>aus dem current Dir, in dem auch die JSP liegt.<br>
<%= request.getServletPath() %><br>
<%= request.getContextPath() %><br>
<%= request.getRealPath("/jsp") %></h3>
<APPLET CODE="AppletLoad.class" WIDTH="100" HEIGHT="50" >
</applet>
<hr>
<h3>jetzt mit Codebase</h3>
<APPLET
CODE="AppletLoad.class"
CODEBASE="../applets"
WIDTH="100"
HEIGHT="50" >
</applet>
<hr>
</body>
</html>
</pre>
Im o.a. Beispiel gibt es unter dem Webapp-Dir. zwei Subdirs, jsp und applets. 2 Applet-Class Dateien müssen je in jsp und in applets stehen.
<p>
Die Aktion plugin brauchst du nur, wenn du in deinem Applet neuere API-Aufrufe hast (höher 1.1.4).
<p>Gerhar
Comment
Comment