Trying to include an applet in a JSP page
Hello,
I have a jsp page trying to include an applet class in it.
Both of them are part of a war file put on an apache server.
The directories tree looks like this :
root
MyJSPPage.jsp
WEB-INF
classes
MyDir
MySubDir
MyApplet.class
In MyJSPPage.jsp, the code looks like this :
<jsp:plugin type="applet"
code="MyApplet.class"
codebase="/WEB-INF/classes/MyDir/MySubDir">
</jsp:plugin>
When loading the page on my browser, it fails, and the java console indicates the following :
java.lang.ClassNotFoundException: MyApplet.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:536)
I tried several things for codeBase :
codebase="/WEB-INF/classes/MyDir/MySubDir"
codebase="/MyDir/MySubDir"
codebase="MyDir.MySubDir"
without any success.
Could you tell me what is wrong?
Thanks in advance,
Olivier
Hello,
I tried what you proposed.
It continue to fail. I think I haven't give you the whole stack :
charger : classe MyClass.class introuvable.
java.lang.ClassNotFoundException: MyClass.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:252)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:42)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:140)
What ca this HTTP connection failed stuff be?
Help, thanks in advance,
Olivier
Similar Messages
-
How can i load a applet in a jsp page
hi ,
i am chiranjit , i am working in a jsp project . i want to load a applet in a jsp page.previously i had tried this one through <jsp:plugin> but when it goes in cross platform this page unable to load the applet from the serverside.
if have any solution then pls send the solution in forum.
thank you.
chiranjitI never tried this... but doesn't the normal html <applet> tag work?
-
Passing input parameters from an applet to a JSP page
Hello all,
Yes, its one of these questions which I have tried to find a solution from the already large number of postings but with no luck. I'm still a novice to Java/JSP so bear with me.
Consider this scenario.
1. An applet which has two input boxes (say First name and surname). 2. These parameters will be passed to a JSP page (so the applet will call a JSP page).
3. The JSP will have have the necessary logic (or actually a JavaBean will) to connect to a database and add a new record with these parameters (first name and surname).
I also need to consider editing/updating the record in the database. So a JSP page will connect to the database, retrieving the required record from the database and then display the parameters back in an applet in two input boxes (first name and surname) to be edited and saved again.
I have been able to develop a similar application using simple HTML forms to add and update records in a database so I'm not worried about the database connectivity simply the issue of passing parameters from the applet to the JSP page and vice versa (for edit/update).
Once i've managed to do this with input boxes, I can experiment with the other input types radios, checkboxes, select etc.
Many thanks in advance,
Assadcreate an URL object with u'r specified link of the java class and send the parameters..write trhis action in any buttonclick event in u'r applet.
-
Hi,
I have an applet application that i want to deploy on the Oracle cloud.
So i have created a jar file for the applet application and i am using this jar to call the applet on a jsp page.
But when i am delpoying my application on the java cloud, its giving me the below error:
2014-10-28 03:16:41 CDT: Starting action "Virus Scan"
2014-10-28 03:16:41 CDT: Virus Scan started
2014-10-28 03:16:49 CDT: ----------------------------------------------------------------------
2014-10-28 03:16:49 CDT: File Scanned: "Application7.ear".
2014-10-28 03:16:49 CDT: File Size: "106698122".
2014-10-28 03:16:49 CDT: File Status: "INFECTED".
2014-10-28 03:16:49 CDT: ----------------------------------------------------------------------
2014-10-28 03:16:49 CDT: Virus scan failed.
2014-10-28 03:16:49 CDT: "Virus Scan" complete: status FAILED
Can't we deploy any application having applet or swing component's onto the cloud?
Or do we need to request for any extra permissions for the same?
Thanks,
ManojI don't see applets mentioned in the supported features nor in the unsupported features so not sure if they are supported you would likely need to contact the operations team to confirm.
Jani Rautiainen
Fusion Applications Developer Relations
https://blogs.oracle.com/fadevrel/ -
CHART BUILDER ERROR WHEN TRYING TO GENERATE DYNAMIC CHARTS ON A JSP PAGE
I'm working with J Develop 9.03 on Windows 2000 Professional Edition.
I'm using the JSP demo files provided with Oracle Chart Builder to generate
dynamic charts. The user specifies the query parameters, including the date
range and the query results are returned by means of a line chart (with date on
the x axis and values on the y axis).
When trying to compile the project I get the following error messages:
Error(165,2): class FileOutputStream not found in class _graph
Error(170,5): class File not found in class _graph
Error(176,4): exception java.io.IOException is never thrown in the
corresponding try block
I checked to see that the chartbuilder library (chartbuilder.jar) files are
loaded into the project library. It's unusual that the class is not being
found. I don't understand why. I developed my project using the following steps:
1. Unzipped Chart Builder installation files into c:\Oraclechartbuilder
2. Loaded chartbuilder class library
c:\Oraclechartbuilder\chartbuilder\lib\chartbuilder.jar into J Developer class
path (by selecting <Project Settings> <Paths> and browsing to the
chartbuilder.jar file).
3. Created a new JSP page in J Developer (graph.jsp)
4. Copied JSP code syntax from the Word Pad demo file and pasted into graph.jsp
5. Changed the DB connection parameters and static directory location on the
JSP page.
6. Compiled the project and received the above errors.
I would like to know why the classes are not being found and how to fix the problem. Thanks, JaafarHi mshah101,
This can happen if the applet is compiled using an higher version of java and the browser is pointing to an older version (even if minor version number is higher) -
Include a Servlet into a JSP page
Hi guys,
When i try to include a Servlet into my JSP, the execution of the JSP stops...Somebody know why???Hi guys,
When i try to include a Servlet into my JSP,the
execution of the JSP stops...Somebody knowwhy???
No, and do you know why ? Bcos including a
servlet
in
a jsp doesnt stop the execution of the jsp. Sotell
us that you tried to do, post some relevant
code,
for us to help you.
ram.<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page buffer="500kb"%>
<html>
<head><title>JSP Page</title></head>
<body>
<jsp:include page="/showCryptValue"
ptValue" flush="true" />
asdfasdfasdfasdfasdf
</body>
</html>
that's the source code....do you have any idea????
Thak's a lottttFrom linxpda:
1) setting the flush="false" parameter for thejsp:include tag?
Here is the problem that I, and perhaps linxpda,
think you have:
You get an exception in the servlet.
You have already written to and flushed the response,
therefore you can not see the exception on your
screen (seeing the exception on screen requires a
send redirect to the error page, which can't happend
when the response is already committed).
The exception that is occuring MAY be alreay written
in your logs, take a look.
To see the problem on screen so as to be able to
identify it, make sure your include tag DOES NOT
flush the buffer. That means change
<jsp:include page="/showCryptValue" flush="true" />
to
<jsp:include page="/showCryptValue" flush="false" />Hi!
No even setting flush false or true it works...If somebody have done this before tell me how have you did....If you can post your code!
[]'s
Falow -
How to include external js file in jsp page??
Hiii...i am new bie in jdeveloper....
and trying to add external js file to a jsp page...
the adress of javascript file is [ Web Content/WEB-INF/jsp/script/test.js ]
adress of jsp page is [ Web Content/WEB-INF/jsp/WelcomePage.jsp ]
so what source address of js file i have to give in jsp page.....Hi,
In order for the jsp page to get the js file, it has to be accessible via an http request, and files in WEB-INF aren't. You'll have to put the js file in a different location or provide another way to get the file, such as via a servlet request.
This is the way to do it. I don't see a use case in that adding a JS file to WEB-IF provids any benefit as the sources could be looked up from the browser anyway. So if your intention is to secure the JS sources, this wont work.
Frank -
Include jsf file in a jsp page
Hi Everyone,
I have a plain jsp page with no JSF Components, but it has a jsp:include tag which is another jsp file which contains jsf components.
When i try to run the plain jsp file ... i get the following error...
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:324)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jsp.DynamicWebpart_jsp._jspService(DynamicWebpart_jsp.java:278)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jsp.Webpart_jsp._jspService(Webpart_jsp.java:302)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
.......... so.....on........
I saw the source code for the plain jsp file and the error is because of including the jsp file with jsf components.
The contents of both the jsp file is given below
Plain jsp file
DWStaticJSP.jsp
<%@ page import="java.util.*" %>
<%@ page import="com.mirus.bi.jsp.*" %>
<%@ page import="com.mirus.bi.util.Log" %>
<% Log.logDbg("*******before calling the faces file from DWStatic :"+rSetting.getStaticJSPFileName()); %>
// name of the file name : /faces/report_palm.jsp
<jsp:include page="<%=rSetting.getStaticJSPFileName()%>" flush="false" >
<jsp:param name="DMode" value="DBoard" />
</jsp:include>
Jsp file with JSF component
it is stored in faces folder
/faces/report_palm.jsp
<%@ page contentType="text/html" %>
<%@ page import="com.mirus.bi.util.Log" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://mirus.com/jsftaglib" prefix="my" %>
<f:view>
<h:outputText value="Store Name:" />
<h:outputText value="#{palmReportUIHandler.currentStoreDisplay}" />
<h:outputText value="Year:" />
<h:outputText value="#{palmReportUIHandler.currentYear}" />
<h:outputText value="Month:" />
<h:outputText value="#{palmReportUIHandler.currentMonth}" />
</f:view>
The Configuration in the web.xml for faces Servlet is given below
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
Does anybody know the solution to this problem
Any kind of help will be highly appreciated.
PinkeshHi Adam Winer,
I want to try your solution.
just wanted some more clarification .....
So, let's say you have:
DWStaticJSP.jsp: plain JSP
report_palm.jsp: JSF JSP included by DWStaticJSP.jsp
What you should do is use an URL of:
/faces/DWStatic.jsp
to access the outer plain JSP (yes, even though it's not really a faces page), and then have
/faces/DWStatic.jsp include just plain /report_palm.jsp.
In essence, the critical thing is that the FacesServlet wraps the entire request - FacesServlet cannot run
for just a piece of the request.My question is where should i store the DWStatic.jsp file ... As u said i should acces it using /faces/DWStatic.jsp do i need to save it in the faces folder or just in the web app root.
I cant save the DWStatic.jsp in the faces folder as this file is used for lot of different purpose in my company application.
So can u give me a solution where in i can keep the DWStatic.jsp in the web-root folder and still try your solution
Also is this the right setting for facesServlet in the web.xml.
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
Whatever follows below this line is the describtion of the web appp structure which i have in my company.
We have an application where in all the jsp files are stored in the web-app root folder.....
I will be using alphabets like a.jsp ... b.jsp .... to keep the explanation small...
I have an a.jsp file which includes a b.jsp file which in turn includes a c.jsp......
Now we have started using JSF.....
Now as a developer .... i want the c.jsp to include a d.jsp file which contains JSF components...
The thing is i cant change the location of a.jsp, b.jsp and c.jsp......
Can u tell me how i should call " a.jsp" ... imean the url so that the "d.jsp" file gets processed properly.
Also where should i save all the jsp files and what config is requiered in the web.xml for your solution
I thank you for your help
Pinkesh -
Trouble with an applet on a jsp page
hi, thanx for readin it!
im developing a webapp tha have some swing applets , the problem is that the applets dont work, they appear but dont play anything, i use the jsp:plugin to load the applets on the jsp, i also have instaled the java plugin on my win xp pc, i use tomcat 5. well i hope you can help mewere are the applet classes? under WEB-INF? If so, then they shouldn't be as the server won't server files under that directory and the browser needs them
-
Can I include a servlet in a jsp page?
Is there anyway to include a Servlet in JSP page?
What exactly do you want to achieve? And are you using 'include' in the generic sense or in the [JEE sense|http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html#include(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse)]?
By the way, behind the scenes, a JSP gets compiled into a servlet.
Edited by: nogoodatcoding on May 18, 2009 9:50 AM -
How include a Servlet into a JSP page?
Hi!!
I need make a combobox with a servlet and place its result into a jsp page.
The servlet is in a package, but when i do: <jsp:include file="sic.view.servlet.ComboServlet" />
tell me that "file attribute isn�t a valid attribute name"
whow can i do to make the combobox whit the servlet and include this into the jsp page??
Thanks!!
PD: Sorry my pour English...Servlets should be mapped to a URL, then you access the servlet via that URL.
The servlet mapping is done in the web.xml (in WEB-INF/ directory of your web application)
<servlet>
<servlet-name>
Combo_S
</servlet-name>
<servlet-class>
sic.view.servlet.ComboServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
Combo_S
</servlet-name>
<url-pattern>
/combo
</url-pattern>
</servlet-mapping>Then you would use:
<jsp:include file="combo" />
to include it.
Make sure the class file gets put in the right package under WEB-INF/classes/ -
How to include the javafx program in JSP page
I am working on a college project and i have got a problem that how will I can use the javafx program in JSP.
plz imform me as soon as possibleThe JavaFX app can be included in JSP as an Applet.
-
How to Include a servlet in a jsp
Hello,
My jsp pages are all tied to respective Servlets. So when I have to forward to a jsp, I forward to a servelt which redirects to that jsp.
Now I have a jsp page which has to include another jsp page.
So I am trying to include a servlet in my jsp page which inturn redirects itself to the included jsp.
Have tried doing the following
<jsp:include page="../../servlet/ServletName" flush="true">
</jsp:include>
does not work. It compiles well but no output
any ideas ????
~ SoumyaIt does not seem to work... Let me give you the snippet of code I used.
calendarEntry.java - the parent jsp
<tr rowspan="60%">
<td width="100%">
<jsp:include page="file://c:/../../servlet/MonthEventList">
</jsp:include>
</td>
</tr>
MonthEventList.java - the included servlet
import javax.servlet.*;
import javax.servlet.http.*;
public class MonthEventList extends HttpServlet {
* Attributes
private static final String CONTENT_TYPE = "text/html";
private HttpSession session;
public void init() throws ServletException
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException
try {
HttpSession session = request.getSession(true);
String url;
url = "/jsp/site/calendar/monthEventList.jsp";
//ReDirect to where the page is going
response.sendRedirect(url);
return;
} catch (Exception ex) {
String url="/jsp/site/calendar/main/servletError.jsp;
response.sendRedirect(url);
return;
public void doGet(HttpServletRequest request,HttpServletResponse
response) throws ServletException, IOException
doPost(request, response);
monthEventList.jsp
just displays some dummy data
So if this is the case, do you think the <jsp:include> can work ??
Thanks in advance
Soumya -
XML syntax error in a JSP page.
Hi,
i was trying to include xml syntax in a jsp page in stead of core jsp syntax. it didn't work.But the jsp document with the core jsp syntax works. I'm wondering what's the problem.any help would be really helpful. I'm using Tomcat 3.2.1.
Thanx in adv,
Ganesh
JSP file - NOT WORKING
<jsp:directive.page import="java.util.Date"/>
<jsp:declaration>
private static String loadTime = new Date().toString();
private static String getLoadTime() { return loadTime; }
private static String getCurrentTime() { return new Date().toString(); }
</jsp:declaration>
<HTML>
<HEAD><TITLE>XML and JSP</TITLE></HEAD>
<BODY>
JSP page is created using XML syntax...<BR>
This page was loaded into memory at <%= getLoadTime() %>.<BR>
The current time is <%= getCurrentTime() %>
</BODY>
</HTML>
ERROR :
Error: 500
Location: /test/declarations.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\tomcat321\tomcat\work\localhost_8080%2Ftest\_0002fdeclarations_0002ejspdeclarations_jsp_6.java:59: Method getLoadTime() not found in class _0002fdeclarations_0002ejspdeclarations_jsp_6.
out.print( getLoadTime() );
^
C:\tomcat321\tomcat\work\localhost_8080%2Ftest\_0002fdeclarations_0002ejspdeclarations_jsp_6.java:65: Method getCurrentTime() not found in class _0002fdeclarations_0002ejspdeclarations_jsp_6.
out.print( getCurrentTime() );
^
2 errorsHi,
any help on this question would be really appreciated..
Thanx in adv,
Ganesh -
Hi
How do i include an applet in a jsp file.I need to send a parameter to
the applet as well .
ThanksYou use an HTML Applet tag:
http://java.sun.com/j2se/1.4.1/docs/guide/plugin/developer_guide/using_tags.html
Maybe you are looking for
-
I downloaded ios 7 today 09.19.2013 on my iphone 4 and ipad retina 3hrd generation 64g . The switch from photo to video on the camera app does not work neither on iphone nor on ipad. Is it a "youth"bug ?
-
Apple TV worked until today. Message says unsupported signal check your output device. I have checked hdmi cable with another device and it's fine. Put on a different tv and same message. Went out yesterday and bought a new Apple TV and same proble
-
Just had to buy a new computer because ours died. Not allowing me to download my itunes from my ipod classic or my ipod nano, any ideas, don't want to loose it all?
-
Skype desktop crashes on windows 8.1
Interesting, Skype for Desktop has been working for me for the past week since I did the Vista / Service Pack compatability thing. However, I just installed Chrome and I can go to a few simple website (like my own) but it crashes on most websites.Wha
-
What adobe product to use to create MP4 with video and slide images with time codes
I wanted to create an MP4 that has video and PPT slide converted to JPG images. What software should I use to create one? Thanks for your help.