Calling applet in JSP
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
Similar Messages
-
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 -
i have made a line graph in applet and i want to call that applet in my jsp project's page....
<jsp:plugin type= "applet" codebase="." code= "ibill.lineGraph.class" width="400" height="400">
</jsp:plugin>
but it dosnt show the applet and give error of Loading java applet is failed....
can anyone help me please
with regardsIn one of my project i tried to load applet using the <jsp:plugin> tag but failed. Since i had less time so i have not done the R&D instead i called the applet as
<applet id="MyApplet" code="MyApplet.class\" archive=\"MyApplet.jar\" width=5 height=3/>and it worked fine for me. You can try this method.
NOTE: My applet jar file was in the same directory of my JSP page
Message was edited by:
diptaPB -
Hi All,
When I tried to call an applet in my JSP page ,it says like " java plugin not installed properly"...I don't know what is wrong with my installation.I'm using jswdk server.
Could anyone help me please....
Would Appreciate if I get help.
Subha.Hi
A plugin is used as a substitute to the browser VM as somtimes the client browsers may not have the right version of the VM to run some components like Swing etc.
The way you handle this in JSPs is that you use the <jsp:plugin> option . Any good tutorial on JSps will give you information on this.
One place to start would be:
The <jsp:plugin> directive takes care of generating all the HTML code necessary to embed and activate a Java applet. Consider the following example:
<html>
<head>
</head>
<body>
<jsp:plugin type="applet" code="NewsTicker.class" name="newsticker"
height="100" width="100">
<jsp:params>
<jsp:param name="x" value="10"/>
<jsp:param name="y" value="25"/>
<jsp:param name="cx" value="90"/>
<jsp:param name="cy" value="114"/>
<jsp:param name="bgcolor" value="102,102,153"/>
<jsp:param name="textcolor" value="0,0,0"/>
<jsp:param name="hilitecolor" value="255,0,0"/>
</jsp:params>
<jsp:fallback>Oops! Something bad happened and I can't display this
applet</jsp:fallback>
</jsp:plugin>
</body>
</html>
The code above sets up the applet contained in "NewsTicker.class", and passes it a bunch of name-value pairs of parameters. The <jsp:param> tag is used to pass these
parameters to the applet, while the <jsp:fallback> directive contains error text, in the event that the applet cannot be found or displayed.
When JSP compiles and renders the page, the code above is automatically converted to its HTML equivalent.
<html>
<head>
</head>
<body>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="100"
height="100"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#V
ersion=1,2,2,0">
<PARAM name="java_code" value="NewsTicker.class">
<PARAM name="type" value="application/x-java-applet;">
<PARAM name="cy" value="114">
<PARAM name="cx" value="90">
<PARAM name="bgcolor" value="102,102,153">
<PARAM name="hilitecolor" value="255,0,0">
<PARAM name="y" value="25">
<PARAM name="x" value="10">
<PARAM name="textcolor" value="0,0,0">
<COMMENT>
<EMBED type="application/x-java-applet;" width="100" height="100"
pluginspage="http://java.sun.com/products/plugin/"
java_code="NewsTicker.class"
cy=114
cx=90
bgcolor=102,102,153
hilitecolor=255,0,0
y=25
x=10
textcolor=0,0,0
>
<NOEMBED>
</COMMENT>
Oops! Something bad happened and I can't display this applet
</NOEMBED></EMBED>
</OBJECT>
</body>
</html>
The above sample was taken from the two links shown below.
- http://home.netscape.com/assist/net_sites/embed_tag.html
- http://www.devshed.com/Server_Side/Jserv/JSP8/print.html
For further reading the documentation that comes along with your application server should provide ample guide to using jsp:plugin with your applets.
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support -
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. -
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.
-
Problem in calling applet function in jsp
When i am trying to load Java applet through jsp, i get this error :
Java Plug-in 1.6.0_02
Using JRE version 1.6.0_02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\pankajb
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
load: class CAppletDisplay.class not found.
java.lang.ClassNotFoundException: CAppletDisplay.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
<jsp:plugin type="applet" code="CAppletDisplay.class" codebase="." width="857" height="687" align="left">
<jsp:params>
<jsp:param name="machine" value="server" />
<jsp:param name="port" value="1433" />
<jsp:param name="Databasename" value="Timba" />
<jsp:param name="userid" value="sa" />
<jsp:param name="password" value="password"/>
</jsp:params>
<jsp:fallback>There is a problem with your browser ...</jsp:fallback>
</jsp:plugin>load: class CAppletDisplay.class not found.
java.lang.ClassNotFoundException: CAppletDisplay.classthat means that client jre didn't find the CAppletDisplay class.
make sure that you put this class in the right directory. -
Passing data from Applet to JSP and back
What is the best way for me to communicate between an Applet and a jsp page? I want to be able to call Applet methods from the JSP and be able to send data to the JSP from the Applet. Thanks.
Can't do this
JSP lives on the server. When it's done, the code is sent to the client
So, in terms of lifespan...
JSP -> Internet -> Client -> Applet
JSP is dead before applet starts -
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. -
Hi,
Can any one tell me how to call JApplet from JSP? I am using <jsp:plugin>
tag but it is not working.use the jsp:plugin tag like this in your jsp page..
<jsp:plugin type="applet"
code="appletclsname.class"
codebase="ourapplets"
jreversion="1.5"
width="400px"
height="200px">
</jsp:plugin> -
i m trying to call it from jsp using
<a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
but its giving error..
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).i m trying to call it from jsp using
<a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
but its giving error..
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed
for the requested resource (HTTP method GET is not
supported by this URL).Are you implementing the doGet or doPost method in your servlet? If you are calling from a hyperlink then it needs to be implementing the GET method. To access the POST method use a html form. -
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> -
Error while calling applet in HTML in SAP NWDS
Hi,
We have written a java code with Main method and we are trying to run it on web. So we have written another piece of HTML code where we are calling the othe program with applet. But getting below error.
Below is exce[ption I am getting while running jree charts made in java :
Java Plug-in 1.6.0_24
Using JRE version 1.6.0_24-b07 Java HotSpot(TM) Client VM
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
java.lang.reflect.InvocationTargetException
at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.InstantiationException: org.jfree.chart.demo.BarChartDemo
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.InstantiationException: org.jfree.chart.demo.BarChartDemo
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 15 more
Exception: java.lang.reflect.InvocationTargetException
Below is html code run to call applets :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "" title="http://www.w3.org/TR/html4/loose.dtd">" class="link">http://www.w3.org/TR/html4/loose.dtd">
(http://www.w3.org/TR/html4/loose.dtd)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello</title>
</head>
<body>
<applet code=org.jfree.chart.demo.BarChartDemo archive="src.jar" width="320" height="120"></applet>
</body>
</html>
Please suggest.
Regards
AgamaniHi,
Though there are a lot of importing parameters, you should give only one structure for outtable, and read as index 1 and index 2.
FORM GET_SPRAS TABLES intable STRUCTURE itcsy
outtable STRUCTURE itcsy.
DATA: lv_kunnr LIKE kna1-kunnr.
CLEAR: GV_SPRAS.
lv_kunnr = intable-value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_kunnr
IMPORTING
output = lv_kunnr.
SELECT SINGLE LAND1 SPRAS INTO (gv_land1, gv_spras) FROM KNA1
WHERE KUNNR = lv_kunnr.
IF sy-subrc = 0.
READ TABLE outtable INDEX 1.
outtable-value = gv_spras.
MODIFY outtable INDEX 1.
READ TABLE outtable INDEX 2.
outtable-value = gv_land1.
MODIFY outtable INDEX 2.
ENDIF.
IF gv_land1 EQ 'DE'.
CLEAR: GV_LAND1,
GV_SPRAS.
ENDIF.
ENDFORM.
Edited by: Srinivas Kalluri on Mar 30, 2009 5:00 AM
Edited by: Srinivas Kalluri on Mar 30, 2009 5:10 AM -
Error while calling applet from Javascript via LiveConnect and WebDriver
Hi all,
I am trying to call applet Java code from Javascript via WebDriver.
Given the following two cases:
- calling a static method: Integer.parseInt("42")- constructing a new object: new String("Hello world")My Javascript code looks like this:
document.appletId.Packages.java.lang.Integer.parseInt("42");
new document.appletId.Packages.java.lang.String("Hello world");When executing this code in Firefox via the Firebug Javascript console everything works fine and I get the expected results. However, when executing this code via the JavascriptExecutor from WebDriver only the call to the static method succeeds, the construction of the new object leads to the following error: "Attempt to call a default method on object with no invokeDefault method."
I don't have any idea what is going wrong here, so any help would be greatly appreciated.
Thanks!Hello Gerard, Hello Krishna,
-> The liveCache application failed with COM error::
40028 Illegal timestamp in rough timegrid
More details about COM error 40028 you will see in TA /n/sapapo/om10
-> Return code: 40028 -> execute ::
Invalid time stamp in the time buckets profile relation
( om_ts_tgrelinvalidstamp )
< click on '?' mark >
-> Open an OSS message in accordance with SAP note 167280 if further help
needed to solve the issue on your system.
Thank you and best regards, Natalia Khlopina
Maybe you are looking for
-
In design CS2 has it been dumped completely by this awful company
My problem is that Indesign CS2 wont open any longer. I bought it as a bundle and paid a huge sum for the full Creative suite. I was told at the time that I could run a separate copy on my laptop at the time. Later when I tried to do that I found tha
-
Shared Libraries with Apple OS & PCs in the same network...
We are currently in the process of updating InDesign files. Some of the InDesign users on the network are using InDesign from PC-based laptops. Others are using InDesign from Apple OS laptops. All are on Adobe CS5. One of the tasks of the rebrand is
-
ME51(2/3/4)N Reset release purchase requisition
Hello, I need to reset the issue of the purchase request after a specific condition occurs. To reset the issue I found the user exit EXIT_SAPLMEREQ_010 (Includes ZXM02U12 MEREQ001 and extension). I first used this function: CALL FUNCTION 'ME_RE
-
Workflow - Create a new buisness object type for an new infotype.
Hi all, I have an issue with creating a new buisness object type, which is related to a supertype, for an new infotype. I am new to workflow and business object. I don't have much knowledge in these area. I need to resolve this problem ASAP. Could so
-
Iphoto 08 vs aperture book templates
I too wanted to use the new book template from iphoto 08... But I can't get this accomplished... There should be an easy way to import / export (depending on which program) to use the new book templates from iphoto 08 into Aperture. This release of i