Applet inside JSP trouble
Hi,
I am having trouble in configuring my application to run an applet inside my JSP pages.
This is my dir structure:
team/WEB-INF/classes/team/DBAccess.class
team/WEB-INF/lib/ojdbc14.jar
team/AppletClass/MyApplet.class
team/reports/report.jsp
team/main.jsp
The Applet class MyApplet is called from within report.jsp by the following codes of line:
<jsp:plugin type="applet" code = "MyApplet" codebase="../AppletClass/"></jsp:plugin>
The applet works fine if I code it as a stand alone and not using DBAccess class. That is, it appear on my JSP page, however when I use elements from DBAccess class, which is inside WEB-INF/classes/team, it does not load!
I have added D:\team\WEB-INF\classes\team into CLASSPATH variable of my win2K system.
Please help!!! I somehow need this applet class to access DBAccess to query DB and display results on the applet.
You are actually getting confused with server side execution and client side execution.
Applet is something that run in client side.
If you see your directory structure you have DBAccess.class in
team/WEB-INF/classes/team/DBAccess.class directory
hope you might be knowing WEB-INF is internal to app server not to the client. so applet can;t find the path for DBAccess.class file.
You have to put that class in team/AppletClass or any other folder where the client applet can access .
Similar Messages
-
Can we plugin Signed applet inside JSP
HI,
Can we use an applet jar file that has written to save a file inside the JSP page.If we plugin will it provide the security options.Any way is to solve this particular problem .pls give me solution.
thnx,
loginYou are actually getting confused with server side execution and client side execution.
Applet is something that run in client side.
If you see your directory structure you have DBAccess.class in
team/WEB-INF/classes/team/DBAccess.class directory
hope you might be knowing WEB-INF is internal to app server not to the client. so applet can;t find the path for DBAccess.class file.
You have to put that class in team/AppletClass or any other folder where the client applet can access . -
How to use jsp:plugin type="applet" in jsp
Hi ,
I have a JSP File.
How to use jsp:plugin tag in that.
When I specify the file name in code="applet.class" Then it is giving an error saying that It could not find the class.
What is the solution for this.its not working.. it shows exception class not found exception.
i have placed the jsp and applet class in the same folder. but its not working.
jsp file path : OracleSpatial\mypackage\webmap.jsp
applet class : OracleSpatial\mypackage\demoApplet.class
demoApplet class inside package "mypackage".
code inside JSP is :
<jsp:plugin type="applet"
code="mypackage.demoApplet.class" width = "100%" height = "100%" >
</jsp:plugin> -
How to import and display an applet from JSP
i m using netbeans 5.0
i have class named myapplet.class
and jsp named myjsp.jsp
now i want to access(import) this myapplet.class from jsp
also i want to display this applet from this jsp
i am able to do either thing but not both
so please help me it is so urgent and important for me bcoz
i have to complete my project as early as possible
Thanks in advancemy jsp source file page path is D:\Reliance
project\WebApplication3\web\
and classes path is D:\Reliance
project\WebApplication3\build\web\WEB-INF\classes\
so problem is that if i want to use myapplet.class
then i have to put my class in D:\Reliance
project\WebApplication3\build\web\WEB-INF\classes\
location
but at that time i am not able to display this applet
on my jsp
if i put my myapplet.class in
D:\Reliance project\WebApplication3\web\ then i m
able to display
applet but not able to access(import) this class
hope you will got the problem!!!
thanks for your reply !!!try to set the path of your applet on jsp something like this
"WEB-INF/classes/myclass.class" -
How can I pass a variable to an applet in JSP?
I want to invoke an Applet in JSP and pass a variable( ie. port) to the Applet. I do as follows:
<applet code="best.Applet1.class" width=400 height=300 >
<param name=port1 value=port>
</applet>
in Applet1.java , I use getParameter("port1"),yet I got character string "port" ,not the value of port(i.e. 100).
How can I get 100 not "port"? Thanks!!!Assuming that port is a variable defined and initailized in the jsp:
<applet code="best.Applet1.class" width=400 height=300 >
<param name=port1 value=<%= port %>>
</applet> -
Re: Including Applet in JSP with Dynamic input| Help needed
Hi All,
We are into a project in Oracle Portal Server where in we want to embed a result of a standalone application in Portal page.
We can do that once we can embed the result of the standalone application which generates applet based on the input it gets from the current application's database.
If it was static we could have used jsp:plugin but, it fails in our case!
We are clueless as to how to embed an applet which will pick up the data dynamically.
Can anyone of you help me in this regard?
Thanks & Regards
ArthiHi Arthi,
I think this might help you to get an idea why jsp:plugin tag does not allow for dynamically called applets.
<jsp:plugin type=applet height="100%" width="100%"
archive="myjarfile.jar,myotherjar.jar"
codebase="/applets"
code="com.foo.MyApplet" >
<jsp:params>
<jsp:param name="enableDebug" value="true" />
</jsp:params>
<jsp:fallback>
Your browser does not support applets.
</jsp:fallback>
</jsp:plugin>
The plugin example illustrates a <html> uniform way of embedding applets in a web page. Before the advent of the <OBJECT> tag, there was no common way of embedding applets. This tag is poorly designed and hopefully future specs will allow for dynamic attributes (height="${param.height}", code="${chart}", etc) and dynamic parameters. Currently, the jsp:plugin tag does not allow for dynamically called applets. For example, if you have a charting applet that requires the data points to be passed in as parameters, you can't use jsp:params unless the number of data points are constant. You can't, for example, loop through a ResultSet to create the jsp:param tags. You have to hand code each jsp:param tag. Each of those jsp:param tags however can have a dynamic name and a dynamic value.
I think you can get better information if you look in to the below link
http://pdf.coreservlets.com/CSAJSP-Chapter12.pdf
Many Thanks,
Ramesh. -
I am trying to use an applet inside my UIX page. does anyone have any thought on how to do this. I am using Jdev 10g for this. I have gotten as far as the error "element OBJECT not defined in parent pageLayout"
maybe I just need to know where to stick the code?
any thoughts?
thanksok here is the code.
I would like the applet to appear in the middle of the screen, but this is where I could get the applet to display, also I have not put in the side nav yet.
thank for the time and effort.
<content>
<dataScope xmlns="http://xmlns.oracle.com/uix/ui">
<provider></provider>
<contents>
<document>
<metaContainer>
<head title="Heading here"/>
</metaContainer>
<contents>
<body>
<contents>
<form name="form0">
<contents>
<pageLayout title="Title">
<corporateBranding>
<image source="ennovation.jpg" />
</corporateBranding>
<tabs>
<tabBar>
<contents>
<link text="Home" />
<link text="Configuration" />
<link text="Tracking" />
<link text="ReferenceTables"/>
</contents>
</tabBar>
</tabs>
<pageHeader>
<globalHeader>
<contents>
<link text=" "destination=""/>
</contents>
</globalHeader>
</pageHeader>
<globalButtons>
<globalButtonBar>
<contents>
<globalButton text="ERO Suite" />
<globalButton text="Contact Us" />
<globalButton text="Help" />
</contents>
</globalButtonBar>
</globalButtons>
<contents/>
</pageLayout>
<pageLayout xmlns:html="http://www.w3.org/TR/REC-html40">
<contents>
<html:object classid="clsid:8AD9C840-044E-11D1-B3E9- 00805F499D93" width = "1250" height = "575" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
<html:param name = "CODE" value = "com.nwoods.jgo.examples.flower.Flower" />
<html:param name = "CODEBASE" value = "." />
<html:param name = "ARCHIVE" value = "Flower.jar" />
<html:param name="type" value="application/x-java- applet;version=1.3"/>
<html:param name="scriptable" value="false"/>
</html:object>
</contents>
</pageLayout>
<pageLayout>
<contents>
<copyright>
<styledText text="Ennovation Inc 2004"
styleClass="OraCopyright"/>
</copyright>
<privacy>
<link text="Privacy Statement" destination=""/>
</privacy>
</contents>
</pageLayout>
</contents>
</form>
</contents>
</body>
</contents>
</document>
</contents>
</dataScope>
</content>
<handlers>
</handlers>
</page> -
Hello! I wrote an applet and try to put in jsp page in JDeveloper:
<jsp:plugin type="applet" code="CompositeTest.class"
width="400" height="400">
<jsp:fallback>
<p>Unable to load applet</p>
</jsp:fallback>
</jsp:plugin>
and I copy the class file to folder where the JSP page is located. When I start Jsp page I have a message: "Applet not found"
What I do wrong??? PLZ Help!
BEST REGARDSHi,
I am not sure the JSP file, which resides in the public_html directory, is part of the class path of the running application. If you open the project properties, you can see where JDeveloper looks for Java classes. Try and extend this setting to include the public_hml directory (you can also try and just add the source as a library path (see library section))
Frank -
i have already made an applet code for my program....now i want to make it flexible by using JSP...
Should i write the code from scratch (for JSP)....or is there some way i can call the applet from JSP ...
Please suggest.see if this thread helps you
http://forum.java.sun.com/thread.jsp?forum=45&thread=166514
Cheers
Khalid -
Hi al,
When we try to invoke an applet from jsp, applet class is not able to initialize (not able to load the class)
Exception got in java console as follows :
Load: class SignedAppletDemo.class not found.
java.lang.ClassNotFoundException: SignedAppletDemo.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
We are using <jsp:plugin> tag for access applet from jsp in Oracle Appserver.(OC4J).
If anyone have any idea on the above,please let us know. Please pass on steps to follow for access applet from jsp file.
Thanks,
RajkumarReview
URL.openConnection()
and HttpURLConnection -
Applets in Jsp generates ClassNotFoundException
hi there,
I face a problem of calling applets in Jsp.
The code to call applet is:
<jsp:plugin type="applet"
code="core.TextApplet"
width="475" height="350">
</jsp:plugin>
And I have a 'core' directory in source packages and TextApplet.java in core directory.Wehn I run the TextAppletJSP ,it gives me an error message in applet display area:
Exception:java.lang.ClassNotFoundException:core.TextApplet
Anyone who help me for this problem plz.
thanks for your help.
gezahegnI am also getting out of memory errors, and Tomcat keeps increasing in memory on every page refresh. Please let me know if you get this resolved how you did it. Thanks.
-
Unable to load Applet in JSP using Tomcat 5.5.12
Hi
I am aunable to applet in jsp using Tomcat 5.5.12 and JRE 1.5. Below is the code that I am using
<applet
codebase = "."
archive = "WebPOSApplet.jar"
code = "webposprint.WPMainApplet.class"
name = "Trans Applet"
width = "450"
height = "115"
hspace = "0"
vspace = "0"
align = "middle"
>
<param name = "redirectInfo" value = "SearchProducts.do">
</applet>
<%/*%>
<OBJECT
classid = "clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0"
WIDTH = 450 HEIGHT = 115 >
<PARAM NAME = CODE VALUE = webposprint.WPMainApplet.class>
<PARAM NAME = archive VALUE = WebPOSApplet.jar>
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.2">
<param name = "redirectInfo" value = "SearchProducts.do">
<PARAM NAME = "scriptable" VALUE = "false">
<PARAM NAME = model VALUE=models/buckminsterfullerine.xyz>
<embed width="450" height="115" code="webposprint.WPMainApplet.class" archive="WebPOSApplet.jar" type="application/x-java-applet;jpi-version=1.4.2" redirectinfo="SearchProducts.do" scriptable="false" model="models/buckminsterfullerine.xyz" src="webposprint.WPMainApplet.class">
</embed> <COMMENT> <EMBED
type = "application/x-java-applet;jpi-version=1.4.2" \
CODE = webposprint.WPMainApplet.class\
archive = WebPOSApplet.jar\
WIDTH = 373 \
HEIGHT = 167 \
model =models/buckminsterfullerine.xyz \
scriptable = false \
pluginspage = "http://java.sun.com/products/plugin/index.html#download"> <NOEMBED>
alt="Your browser understands the <APPLET>
tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET>
tag! </NOEMBED> </EMBED> </COMMENT>
</OBJECT>
<%*/%>
This code doesn't seems working with Tomcat 5.5.12. I works fine with Tomcat 4.1.31
Please help
ThanksApplets run client side - which means the relevant class files need to be downloaded to the client.
Anything under the WEB-INF directory is not directly accessible by the client. Nothing under WEB-INF can be downloaded.
ergo, specifying the WEB-INF directory as part of your applet codebase is a bad idea.
I would suggest try copying the applet classes from under WEB-INF to some other place in your application.
Also, you should probably specify the full class name of your Applet in the plugin tag.
<%@ page import="com.util.MyApplet" %>
<jsp:plugin type="applet" code="com.util.MyApplet" codebase="/classes" width="250" height="100" jreversion="1.6">
<jsp:fallback>
<B>Unable to start plugin!</B>
</jsp:fallback>
</jsp:plugin>cheers,
evnafets -
Applets in JSP --- I'm going crazy!
I am using an applet I have written on a JSP page which I have also written.
Using: Win2K, IE6, J2SDK 1.4, Tomcat 4.0.3
I have several problems. Even if you can answer only one of them, it will be a great help!
Here is how I'm adding the applet.
<jsp:plugin type="applet" code="RawData.class" name="rawData" jreversion="1.4" width="700" height="55" >
<jsp:fallback>
Plugin tag OBJECT or EMBED not supported by browser.
</jsp:fallback>
</jsp:plugin>
</TD>
Problem 1) I can only get the applet loaded if the applet class file is in the same folder as the JSP file. Anything else, and I get a ClassNotFoundException.
Can't get the CODEBASE to do anything for me at all.
I set my codebase="/RawData/classes", but makes no difference.
I then tried Jarring my applet and placing RawData.jar in the same folder with the JSP. But also no go. I then set codebase="RawData.jar", but guess what... Nothing.
So my questions are: How do I get the applet to load from the applet.class files using codebase if the applet files are in a sub folder? And how do I get my applet to load from a Jar?
Problem 2) Once this applet is loaded, I have the biggest nightmare imaginable to get the browser to load a new version after I have updated it. And trust me, there is not and old version of the applet.class in my ClassPath. In fact there is not another copy of the applet.class file anywhere on my PC. I made sure. I have also disabled the Java Plugin Cache option, and deleted my temporary internet files with Explorer. But the thing persists in loading the old version from somewhere. What the heck do I do? I fear this is driving me insane.. :)
Problem 3) I need the HTML components to interact with the applet.
When I do a call to an applet function passing no parameters it works fine, and I get the value back, like this:
<SCRIPT LANGUAGE="VBScript">
<!--
Sub btnGetID1_OnClick
document.all("id1Pattern").innerText = document.rawData.getSelection()
End Sub
-->
</SCRIPT>
But when I do a function call, passing parameters, the scrip just stops working altogether, like this.
<SCRIPT LANGUAGE="VBScript">
<!--
Sub id1Pos_onfocus
document.rawData.setSelection(5, 10)
End Sub
-->
</SCRIPT>
Why is this. What am I doing wrong.
And better yet... Is there a way of manipulating the HTML components from within JSP scriplet <% ... %>?
Please if anyone can help... It will be greatly appreciated. I am at a loss!
Thanx. QuigrimQuigrim wrote:
Problem 1) I can only get the applet loaded if the applet class file
is in the same folder as the JSP file. Anything else, and I get a
ClassNotFoundException. Can't get the CODEBASE to do anything for me
at all.Set CODEBASE to point to the relative directory where your code is. If it is in the same directory as the JSP then CODEBASE="."; if it is in a sub-directory 'classes' then CODEBASE="classes".
Problem 2) Once this applet is loaded, I have the biggest nightmare
imaginable to get the browser to load a new version after I have
updated it. Close ALL browser windows - you have to force the plugin JVM to re-initialise - I've not found any other way to do it.
Hope these help you.
Phil. -
Process Monitor Diagram Applet in JSP
Has anyone experienced to use Java Applet in JSP to display the process diagram, just as what you can see in the workflow console. I notice that WF_MONITOR has a getMonitorURL() API which returns a link that leads to Workflow Console, I feel this isn't user friendly. If I could bring what user exactly sees the process diagram in workflow console to Java JSP, it would be superb ...........
any idea?
KunAll I can think of is that you are using swing and
including the necessary files via import statements in
the code. This might cause the applet to run fine with
the default Netscape JVM. On the other hand, when
using the jsp:plugin tag the browser is instructed to
download the Java2 plugin regardless of whether the
applet will run or not. What I'm saying is that you
probably don't have the Java2 plugin installed on your
browser rather you have the necessary jar files in
your classpath to support Java2. Does that make any
sense?>
CliffI don't have a shell CLASSPATH variable, and I'm not sure how to tell what CLASSPATH variable Netscape is using.
The applet doesn't use Swing as far as I can tell, the code for this applet is at
http://tmap.pmel.noaa.gov/~callahan/JAVA/map_v3.0/LiveMap_30.java.
It appears to use only awt for imaging, which I think is considered Java1.
A bit off topic:
I have the javaplugin.so which ships with jdk1.3.1_01. However when I look under Edit->Preferences->Navigator->Applications and try to set the plugin used for application/x-java-applet I see that the setting is one for "Unknown - prompt user". Also if I look under Edit->Preferences->Advanced I can see that "Enable Java" is checked and activated but "Enable Java Plugin" is not checked and unavailable (it is greyed-out).
1) How can I get Netscape to "know about" the plugin I have available in my JRE ?
2) How can I tell Netscape to use this plugin for all things Java ?
3) How is it that the applet runs fine when included in a HTML page, even though it appears that my browser's application settings aren't set up to handle applets correctly ?
4) The Netscape Edit->Preferences->Advanced shows that Java is enabled but the plugin is not. I guess I'm missing something here as I thought that the Java plugin was required for anything Java related to run (such as applets) but this is obviously not so since the applet will run fine if coming from the HTML page.
A bit perplexed...
-James -
Advantages and Disadvantages of Applet over JSP/servlet
Can some one please let me know what are the major advantages and disadvantages of using Applets over JSP/Servlet technology?
Well, a servlet / jsp is generated on the server, an applet on the client side. That's the most important difference.
Appelt's usually are for little applications like games and stuff, you can run in a browser.
Servlets are for dynamic pages, for example database-viewing and stuf...
Maybe you are looking for
-
How do I move my Home folder to an external drive?
I am leaving for 3 months. I want to copy the entire Home folder on my iMac to an external drive so I can take it with me. I want to clean up the files/folders, sort and delete thousands of iPhoto pictures, organize hundreds of genealogy documents,
-
Transferring my library to a new computer - errors galore
I recently purchased a Retina iMac running OS 10.10.1. My previous computer is a Mac Pro (2006) with 10.7.5 (latest OS it will support). The Mac Pro has iTunes 12.0.1 with the database files on the system hard drive and the media files on a second
-
What do the leds on the ms6163 ver 2 mobo mean
I have a row of leds on my mobo and would like to know what they mean. The comp wont boot and the first two leds are red while the rest are green. I would like to know what that means. Where can I find this info? Thanks.
-
Hi, this is my first post in this forum. Hi together! I want to replace my ibook G4 1.33 (on which my son is keen on). My main Mac is my iMac G5 which i want to replace with a updated one after Macworld 2009. The question: Should i replace my ibook w
-
HT1473 Organizing My iTunes Library
In my iTunes Library; How do I get all the songs from compilation albums in one folder?