Applet not loading on jsp page
Hi there, I'm learning Java Server Pages now a days, and I wanted to place one applet on my JSP, and I have used jsp:plugin to load this applet on my jsp page, but still it is not working, any idea,
regards,
Raasi.
post your jsp code and write where do you put your applet.
Similar Messages
-
using weblogic server 6.1 sp2, solaris 8 mu7, netscape 6.2.1
the compiled applet UploadScreenshots.class is bundled into a web app
file named roach.war and resides in the following directory in the war
file:
WEB-INF/classes/roach/web/applets/UploadScreenshots.class
trying to deploy applet from jsp with following plugin definition in
jsp:
<jsp:plugin type="applet"
code="roach.web.applets.UploadScreenshots.class"
codebase="/classes/"
height="200" width="500"
jreversion="1.3"
nspluginurl="http://java.sun.com/products/plugin/1.3/plugin-install.html"
iepluginurl="http://java.sun.com/products/plugin/1.3/jinstall-131-win32.cab">
<jsp:fallback>
<font color=#FF0000>Sorry, cannot run java applet!!</font>
</jsp:fallback>
</jsp:plugin>
when executing the jsp from the browser, get the following error
message when browser attempts to load the applet:
Exception: java.lang.ClassNotFoundException:
roach.web.applets.UploadScreenshots.class
however, when codebase attribute is removed from plugin element
definition and the compiled applet class (and its directory) is moved
to the same directory as the jsp, the applet loads and works without
any problems!
what's up???
joseph,
thanks for the follow up. i still was not able to load the applet from
the web-inf directory so i just jarred up the applet, stuck the jar
file in the jsp directory, and added the archive attribute to the
jsp:plugin element. everything loads and works fine. maybe i'll
revisit loading applets from the web-inf directory later. thanks
again.
rick
"Joseph Nguyen" <[email protected]> wrote in message news:<[email protected]>...
> Rick,
>
> Take a look here real quick:
> http://e-docs.bea.com/wls/docs70/jsp/trouble.html#error-plugin. It's not
> much, but if it doesn't help please open a case with BEA Support via
> WebSupport portal here http://support.bea.com/welcome.jsp as there is no
> existing issue in our bug db right now with the jsp:plugin tag.
>
> Regards,
> Joseph Nguyen
> BEA Support
>
> "rick bryant" <[email protected]> wrote in message
> news:[email protected]...
> > using weblogic server 6.1 sp2, solaris 8 mu7, netscape 6.2.1
> >
> > the compiled applet UploadScreenshots.class is bundled into a web app
> > file named roach.war and resides in the following directory in the war
> > file:
> > WEB-INF/classes/roach/web/applets/UploadScreenshots.class
> >
> > trying to deploy applet from jsp with following plugin definition in
> > jsp:
> > <jsp:plugin type="applet"
> > code="roach.web.applets.UploadScreenshots.class"
> > codebase="/classes/"
> > height="200" width="500"
> > jreversion="1.3"
> >
> nspluginurl="http://java.sun.com/products/plugin/1.3/plugin-install.html"
> >
> iepluginurl="http://java.sun.com/products/plugin/1.3/jinstall-131-win32.cab"
> >
> > <jsp:fallback>
> > <font color=#FF0000>Sorry, cannot run java applet!!</font>
> > </jsp:fallback>
> > </jsp:plugin>
> >
> > when executing the jsp from the browser, get the following error
> > message when browser attempts to load the applet:
> > Exception: java.lang.ClassNotFoundException:
> > roach.web.applets.UploadScreenshots.class
> >
> > however, when codebase attribute is removed from plugin element
> > definition and the compiled applet class (and its directory) is moved
> > to the same directory as the jsp, the applet loads and works without
> > any problems!
> >
> > what's up???
-
ClassNotFoundException when trying to access applet (jar) from a jsp page?
I have my applet in a jar file and I am specifying the applet tag in my jsp page as follows:
<applet code="website.utils.DragDropUploadApplet.class" name="DragDropApp" width="17" height="17" archive="utils.jar" codebase="." ></applet>
I tried with and without the codebase. The jar file is at the same location as the jsp page which has the above applet tag, however I get a ClassNotFoundException in the Sun Java Console in Internet Explorer. Any inputs on resolving this will be much appreciated.
Here is the error:
load: class website.utils.DragDropUploadApplet.class not found.
java.lang.ClassNotFoundException: website.utils.DragDropUploadApplet.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
Exception in thread "Thread-12" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-website.utils.DragDropUploadApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
load: class website.utils.DragDropUploadApplet.class not found.
java.lang.ClassNotFoundException: website.utils.DragDropUploadApplet.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
Exception in thread "Thread-13" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-website.utils.DragDropUploadApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
load: class website.utils.DragDropUploadApplet.class not found.
java.lang.ClassNotFoundException: website.utils.DragDropUploadApplet.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
Exception in thread "Thread-14" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-website.utils.DragDropUploadApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
load: class website.utils.DragDropUploadApplet.class not found.
java.lang.ClassNotFoundException: website.utils.DragDropUploadApplet.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
Exception in thread "Thread-15" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
load: class website.utils.DragDropUploadApplet.class not found.
java.lang.ClassNotFoundException: website.utils.DragDropUploadApplet.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
Exception in thread "Thread-16" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-website.utils.DragDropUploadApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-website.utils.DragDropUploadApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks,
MonishaHi 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) -
Loading a .jsp page from another .jsp page?
Hi,
I have following IF statement in "Main.jsp" page to load "ChangeJob.jsp" page. I tested and made sure that The IF condition was true(alert function executed), but ChangeJob.jsp didn't load.
Did i miss something?
Main.jsp
<HTML>
<% if ( (!(woSt.equals("Indirect"))) && (woSt.length()!=0) ){%>
<SCRIPT>
alert("click OK to load Changejob.jsp");
document.form1.action="ChangeJob.jsp";
document.form1.submit();
</SCRIPT>
<%} %>
<BODY>
<form name="form1">
</form>
</BODY>
</HTML>Hi,
The folloing code I am writing but in this my if loop is not working propery.
the problem I am checking for this...
if((!(progcode.equals(pall))) && (!(dcode.equals(dall))) && (!(yr.equals(yall))))
in the belo program I am using but always it is going in to the loop. when they are equal and when they r not eqal....
I have given compleate code in here pleace tell me hot to get it worked it properly.....
<%@ page language="java" session="true"%>
<%@ include file="connect.jsp"%>
<%! ResultSet rs2,rs1;
Statement stmt1,stmt2;
%>
<%
String gpcode=null,pname=null,dname=null,total=null,totalyr=null,gtotal=null;
int gdcode=0,gyear=0,gdata=0,deptcode=0;
String pall=null,dall=null,yall=null;
pall="all"; dall="99"; yall="1900";
String progcode=request.getParameter("programname");
String dcode=request.getParameter("departmentname");
String yr=request.getParameter("year");
deptcode=Integer.parseInt(dcode);
int year=Integer.parseInt(yr);
boolean flag=false;
%> <%= progcode%><%=" "+ dcode%><%= " "+yr%><br>
<%= pall%><%=" "+dall%><%=" " +yall%><br>
<%= progcode%><%= deptcode%><%= year%>
<%
if((!(progcode.equals(pall))) && (!(dcode.equals(dall))) && (!(yr.equals(yall))))
stmt=con.createStatement();
rs=stmt.executeQuery("select * from data where progcode='"+progcode+"' and deptcode='"+deptcode+"' and year='"+year+"' ");
flag=false;
if(rs!=null){
if(rs.next()){
flag=true;
if(flag){
gpcode=rs.getString("progcode");
gdcode=rs.getInt("deptcode");
gyear=rs.getInt("year");
gdata=rs.getInt("totalnoofstud");
stmt1=con.createStatement();
ResultSet trs=stmt1.executeQuery("select * from program where progcode='"+gpcode+"' ");
if(trs.next()){
pname=trs.getString(2);
stmt2=con.createStatement();
rs=stmt2.executeQuery("select * from department where deptcode='"+gdcode+"' ");
if(rs.next()){
dname=rs.getString("deptname");
else {
response.sendRedirect("viewdata.jsp?flag=false");
stmt=con.createStatement();
rs=stmt.executeQuery("select sum(totalnoofstud) from data where progcode='"+progcode+"' and deptcode='"+deptcode+"' ");
if(rs.next()){
total=rs.getString(1);
stmt=con.createStatement();
rs=stmt.executeQuery("select sum(totalnoofstud) from data where year='"+gyear+"' ");
if(rs.next()){
totalyr=rs.getString(1);
else{
stmt=con.createStatement();
rs=stmt.executeQuery(" select sum(totalnoofstud) from data ");
if(rs.next())
gtotal=rs.getString(1);
%>
<html>
<head><title>Passed Out Student Data</title></head>
<body background="foggy2.jpg">
<br><br>
<%
if(progcode!=pall && dcode!=dall && yr!=yall){%>
<%@ include file="getdatasingle.jsp" %>
<%}
else{%>
<br><br><br><center><b><font color="maroon" size=+3>Total Number Of Students Passed Out Till Now Are </font><font color="red" size=+3><%=" "+ gtotal%><
/font></b></center>
<%}%>
<center>
<input type="submit" name="ok" value="OK">
</center>
</body>
</html>
Regards,
Madhavi -
Applet plugin error on JSP page
I currently have an applet using the swing plugin so it's embedded between <object>
tags. When loading the JSP page in the editor the error "Attachment to a running
virtual machine failed" appears with an OK button. When I click the OK button
the entire workshop closes down. Beta Version 8.1 displayed the same error but
didn't crash. The page defaults to open in "Design View" which is where the error
occurs. Any suggestions?Mark,
Can you upload the jsp and the applet ? Also please contact BEA Customer
Support and request that an evaluation case be open for this issue.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Mark" <[email protected]> wrote in message
news:[email protected]..
>
I currently have an applet using the swing plugin so it's embedded between<object>
tags. When loading the JSP page in the editor the error "Attachment to arunning
virtual machine failed" appears with an OK button. When I click the OKbutton
the entire workshop closes down. Beta Version 8.1 displayed the sameerror but
didn't crash. The page defaults to open in "Design View" which is wherethe error
occurs. Any suggestions? -
Java applet was loaded in JSP as HTML.
I was running my web application in Linux platform. I have the lastest mozilla broswer which is 1.7.1. I was installed the Java plugins which this can be proved by i was able to load ICQ2Go of ICQ.com. The Java applet i created was loaded correctly in .html file. Unfortunately the Java applet was not load in .jsp file and a window was pop up to prompt me to go java.sun.com to donwload the proper plugin to view the applet which the link is http://java.sun.com/products/plugin/?application/x-java-applet;. I need help. Please give me a hand. Thank you.
Coding to load Java applet in .jsp
<HTML>
<HEAD>
<TITLE>Applet In Broswer</TITLE>
</HEAD>
<BODY>
<H1>Applet in Broswer</H1>
Fibonacci Test in Java Applet.
<jsp:plugin type="applet" code="foo.FibonacciTest.class" width="800" height="300" >
</jsp:plugin>
</BODY>
</HTML>Coding to load Java applet in .html
<HTML>
<HEAD>
<TITLE>Applet In Broswer</TITLE>
</HEAD>
<BODY>
<H1>Applet in Broswer</H1>
Fibonacci Test in Java Applet.
<APPLET CODE="foo.FibonacciTest.class" WIDTH=800 HEIGHT=300>
</APPLET>
</BODY>
</HTML>Whoops.. I even make a mistaken on the title of my problem - should be is Java applet was not loaded in JSP as HTML. The problem was solved. Thanks for anyone who had view this.
-
Links that open in new windows do not load. The page remains blank. I have downloaded other web browsers and these pages all work with these browsers. I have been using firefox for years and this has only started happening in the last month or so. Is there an update that can fix this? I have also uninstalled and then reinstalled firefox and still the same thing.
There are no error messages, just a picture of a white sheet of paper in the top left hand corner with the writing "search book marks and history". New tabs are working, it's just the new windows that won't load.Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit") -
After upgrading to 9.0.1 Mozilla Firefox on my pc, Firefox will not load any web pages whatsoever, not even itself. My OS is Windows Vista 64. Thanks for any help. (Having to use Internet Explorer presently.)
Perform the suggestions mentioned in the following articles:
* [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
* [[Troubleshooting extensions and themes]]
* Update All your Firefox Plugins -> [https://www.mozilla.org/en-US/plugincheck/]
** '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''
Check and tell if its working. -
Firefox will not load any web pages
Firefox will not load any web pages. I have tried every suggestion on the support page, deleted the program and reinstalled it 4 times, and ran a malware scan. None of these have solved the problem.
Hi JessN37,
We've got a whole [https://support.mozilla.org/en-US/kb/web-pages-dont-load troubleshooting section on failure to load pages]. Have you looked through any of that information? There is a ton of useful stuff there.
Hopefully this helps! -
BLOB image not shows in JSP page!!
Hi Dear all,
I had tried to configure how to show BLOB image to jsp page . The code are works fine and servlet works ok but image can not show only. can you help me that what need to be added. Please help me.
Can any experts help me? BLOB image not shows in JSP page. I am using ADF11g/DB 10gR2.
My as Code follows:
_1. Servlet Config_
<servlet>
<servlet-name>images</servlet-name>
<servlet-class>his.model.ClsImage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>images</servlet-name>
<url-pattern>/render_images</url-pattern>
</servlet-mapping>
3. class code
package his.model;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jbo.ApplicationModule;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.BlobDomain;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ClsImage extends HttpServlet
//private static final Log LOG = LogFactory.getLog(ImageServlet.class);
private static final Log LOG = LogFactory.getLog(ClsImage.class);
public void init(ServletConfig config)
throws ServletException
super.init(config);
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
System.out.println("GET---From servlet============= !!!");
String appModuleName = "his.model.ModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleName");
String appModuleConfig = "TempModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleConfig");
String voQuery ="select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = 'P1000000000006'" ;// 'P1000000000006' this.getServletConfig().getInitParameter("ImageViewObjectQuery");
String mimeType = "jpg";//this.getServletConfig().getInitParameter("gif");
//?IMAGE_NO='P1000000000006'
//TODO: throw exception if mandatory parameter not set
ApplicationModule am =
Configuration.createRootApplicationModule(appModuleName, appModuleConfig);
ViewObject vo = am.createViewObjectFromQueryStmt("TempView2", voQuery);
Map paramMap = request.getParameterMap();
Iterator paramValues = paramMap.values().iterator();
int i=0;
while (paramValues.hasNext())
// Only one value for a parameter is expected.
// TODO: If more then 1 parameter is supplied make sure the value is bound to the right bind
// variable in the query! Maybe use named variables instead.
String[] paramValue = (String[])paramValues.next();
vo.setWhereClauseParam(i, paramValue[0]);
i++;
System.out.println("before run============= !!!");
// Run the query
vo.executeQuery();
// Get the result (only the first row is taken into account
System.out.println("after run============= !!!");
Row product = vo.first();
//System.out.println("============"+(BlobDomain)product.getAttribute(0));
BlobDomain image = null;
// Check if a row has been found
if (product != null)
System.out.println("onside product============= !!!");
// We assume the Blob to be the first a field
image = (BlobDomain) product.getAttribute(0);
//System.out.println("onside run product============= !!!"+image.toString() +"======="+image );
// Check if there are more fields returned. If so, the second one
// is considered to hold the mime type
if ( product.getAttributeCount()> 1 )
mimeType = (String)product.getAttribute(1);
else
//LOG.warn("No row found to get image from !!!");
LOG.warn("No row found to get image from !!!");
return;
System.out.println("Set Image============= !!!");
// Set the content-type. Only images are taken into account
response.setContentType("image/"+ mimeType+ "; charset=windows-1252");
OutputStream os = response.getOutputStream();
InputStream is = image.getInputStream();
// copy blob to output
byte[] buffer = new byte[4096];
int nread;
while ((nread = is.read(buffer)) != -1)
os.write(buffer, 0, nread);
//System.out.println("Set Image============= loop!!!"+(is.read(buffer)));
os.close();
// Remove the temporary viewobject
vo.remove();
// Release the appModule
Configuration.releaseRootApplicationModule(am, false);
} 3 . Jsp Tag
<af:image source="/render_images" shortDesc="Item"/> Thanks.
zakir
====
Edited by: Zakir Hossain on Apr 23, 2009 11:19 AMHi here is solution,
later I will put a project for this solution, right now I am really busy with ADF implementation.
core changes is to solve my problem:
byte[] buffer = new byte[image.getBufferSize()];
int nread;
vo.remove();
while ((nread = is.read(buffer)) != -1) {
os.write(buffer);
}All code as below:
Servlet Code*
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
String appModuleName =
"his.model.ModuleAssetMgt";
String appModuleConfig =
"TempModuleAssetMgt";
String imgno = request.getParameter("imgno");
if (imgno == null || imgno.equals(""))
return;
String voQuery =
"select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = '" + imgno + "'";
String mimeType = "gif";
ApplicationModule am =
Configuration.createRootApplicationModule(appModuleName,
appModuleConfig);
am.clearVOCaches("TempView2", true);
ViewObject vo = null;
String s;
vo = am.createViewObjectFromQueryStmt("TempView2", voQuery);
// Run the query
vo.executeQuery();
// Get the result (only the first row is taken into account
Row product = vo.first();
BlobDomain image = null;
// Check if a row has been found
if (product != null) {
// We assume the Blob to be the first a field
image = (BlobDomain)product.getAttribute(0);
// Check if there are more fields returned. If so, the second one
// is considered to hold the mime type
if (product.getAttributeCount() > 1) {
mimeType = (String)product.getAttribute(1);
} else {
LOG.warn("No row found to get image from !!!");
return;
// Set the content-type. Only images are taken into account
response.setContentType("image/" + mimeType);
OutputStream os = response.getOutputStream();
InputStream is = image.getInputStream();
// copy blob to output
byte[] buffer = new byte[image.getBufferSize()];
int nread;
vo.remove();
while ((nread = is.read(buffer)) != -1) {
os.write(buffer);
is.close();
os.close();
// Release the appModule
Configuration.releaseRootApplicationModule(am, true);
}Jsp Tag
<h:graphicImage url="/render_images?imgno=#{bindings.ImageNo.inputValue}"
height="168" width="224"/> -
I have ipad mini, safari is not loading, cannot open page because server stopped responding??? help
i did bills paid!!! lol just noticed cannot connect to app store either!!
-
My internet explorer is not loading any web pages.
My internet explorer is not loading any web pages. Other browser rather than IE is working fine. Tried with reseting but it didn't work. Can anyone help me for this.Thanks
Hi,
Have you tried to open Interent Explorer (No Add-ons), how is the result?
Please refer to this tutorial to troubleshoot:
"Internet Explorer cannot display the webpage" error
http://support.microsoft.com/kb/956196
In addition, Did you configure any proxy ever?
Karen Hu
TechNet Community Support -
i updated my mac book pro to mountain lion recently and my safari is not loading few web pages including apple sites please help me
I have this problem too but it seems pot luck and only like 5% of the time, the website will say the page is loaded but the page is just blank white...refreshing does not work and I have to go back and navigate to the page again
-
I just download fire 4 beta on my windows vista. Can not open in some websites. the message applet not load properly please reload the page
Your More system details list doesn't show the Java plugin as installed.
Update the [[Java]] plugin to the latest version.
*http://kb.mozillazine.org/Java
*http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE) -
Absence history is not loading in sshr page
Absence history is not loading in sshr page
* For a employee the absence history is not displaying
* Data for the employee is in table per_absence_attendancesHi,
thanks for your update.
We have checked your action plan.But 'Refresh Employee Directory' program not available in System adminstrator Responsibility.
We are using Oracle Apps 12.1.3 Ora DB : 11.2.0.3
Regards
Venugopal.S
Maybe you are looking for
-
HELP ME!!! - DOWNLOADING TV SHOWS FROM AUSTRALIA
I am going crazy. I am desperate to download shows like lost and heroes on Itunes. But it says that i have to go onto the australian intunes. DOES ANYONE KNOW WHEN TV SHOWS AND MOVIES ARE GOING TO BE COMING ONTO AUSTRALIAN ITUNES???
-
My iMac disappears from my network sometimes
I'm not sure what's happened but as of lately I've noticed that my iMac(late 2009) disappears from the network every now and then. What can I do to correct this? Thanks in advance
-
Exception in thread "main" java.lang.NoClassDefFoundError: trial
hi! i am trying to run a simple java program. i am able to run the code in other machine but not on my machine.when i compile i have no problem. when i execute the 'java trial ' i am getting this message. Exception in thread "main" java.lang.NoClassD
-
problems with email is not receiving emails to the phone from my Yahoo I changed pass but I dont think that's the problem it's gone out before any suggestions ?
-
Connecting Xbox 360 to B540 through RF socket?
I am on a mission to connect an Xbox 360 to my B540 which does not have any inputs such as HDMI or even AV. My options seem to be using a video capture card or a RF Modulator/Adaptor (since the machine does have an aerial socket for the built-in TV