Can i display all images from databases with adf jsp
hi
I want to display all images from the databases whit adf bussines components, because with the sample on http://www.oracle.com/technology/training/products/intermedia/index.html page, i only can display 10 images. i'd lije to know if i can to search in the databases by the id of the image.
this is the code:
%@ taglib uri="http://xmlns.oracle.com/adf/ui/jsp/adftags" prefix="adf"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<html:errors/>
<table border="1" width="100%">
<tr>
<th> </th>
<th>
<c:out value="${bindings.ImagenView1.labels['Id']}"/>
</th>
<th>
<c:out value="${bindings.ImagenView1.labels['Descripcion']}"/>
</th>
<th>
<c:out value="${bindings.ImagenView1.labels['Image']}"/>
</th>
</tr>
<c:forEach var="Row" items="${bindings.ImagenView1.rangeSet}">
<tr>
<td>
<c:out value="${Row.currencyString}"/>
</td>
<td>
<c:out value="${Row['Id']}"/>
</td>
<td>
<adf:render model="Row.Image"/>
</td>
<td>
<c:out value="${Row['Image']}"/>
</td>
</tr>
</c:forEach>
</table>
</body>
</html>
I think you want the interMedia JSP tag library...
http://www.oracle.com/technology/software/products/intermedia/htdocs/descriptions/tag_library.html
Larry
Similar Messages
-
Display image from database with jspSmart
Hi
I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
My code looks like this:
imgModifyDataType.jsp
<%
ResultSet myResultSet = null;
Statement myStatement = null;
Connection myConnection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
String iconName;
String pDTID = request.getParameter("dtid");
String mySQL = "Select iconname, icon from data_types where dtid=?";
PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
pstmt.setString(1,pDTID);
myResultSet = pstmt.executeQuery();
iconName = myResultSet.getString("iconname");
myUpload.initialize(pageContext);
myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
%>
I call this JSP from another JSP like this:
<img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
Please help
SajidI think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
the getphoto.jsp PhotoId.
/** getphoto.jsp source code */
<%@page import="java.sql.*,oracle.jdbc.*"%>
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<table width="781" border="2">
<tr<<td>
<td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
stmt = conn.createStatement();
rset = stmt.executeQuery("select photo_id,photo_description from photo");
while (rset.next()) {
%>
<tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
<%
conn.close();
%>
</table>
</body>
</html>
/** getimage.jsp source code */
<%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
<%
String strConnString = null;
Connection oDbConn;
Statement oStmt;
ResultSet oResult;
String strConnection = null;
String strUserId = "c_erober";
String strUserPwd = "sybdev99";
String strDatabase = "oraITAS";
String strPhotoId;
strConnString = "jdbc:odbc:" + strDatabase;
String strSql;
try {
strPhotoId = (String) request.getParameter("PhotoId");
strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
response.setContentType("image/jpeg");
oStmt = oDbConn.createStatement();
oResult = oStmt.executeQuery(strSql);
oResult.next();
byte[] bytearray = new byte[4096];
int size=0;
InputStream sImage;
sImage = oResult.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
response.addHeader("Content-Disposition","filename=getimage.jpeg");
while((size=sImage.read(bytearray))!= -1 ) {
response.getOutputStream().write(bytearray,0,size);
response.flushBuffer();
sImage.close();
oDbConn.close();
} catch (SQLException ex) { ex.getMessage();
%> -
How can i get all values from jtable with out selecting?
i have one input table and two output tables (name it as output1, output2). Selected rows from input table are displayed in output1 table. The data in output1 table is temporary(means the dat wont store in database just for display purpose).
Actually what i want is how can i get all values from output1 table to output2 table with out selecting the data in output1 table?
thanks in advance.
rajaYou could set the table's data model to be the same:
output2.setModel( output1.getModel() ); -
How can I display an image from a shared-network folder?
Hi
Does anyone know how I can display images from within APEX that are found outside the database? What configuration have I missed?
Within Windows-Internet-Explore I can access the following image using the below URLs, BUT I cannot access it from within APEX?
What do I need to do so APEX can display theses images from our internal shared network folder?
both these URLs work within Firefox (but on APEX):
\\Saremote\UPDOWNFILES_DIR\polk_insight.gif
file://///Saremote/UPDOWNFILES_DIR/polk_insight.GIF
So within APEX I have created a "display as Text' Item that works with this "amazon image" syntax:
{lessthan} IMG SRC= {doublequot} http://g-images.amazon.com/images/G/01/associates/navbar2000/logo-no-border(1).gif {doublequot} {greaterthan}
BUT sadly not with my image:
{lessthan} IMG SRC= {doublequot} file://///Saremote/UPDOWNFILES_DIR/polk_insight.GIF {doublequot} {greaterthan}
Any ideas would be appreciated.
Thanks
Steve
Edited by: [email protected] on Sep 12, 2008 8:30 AM
Edited by: [email protected] on Sep 12, 2008 8:31 AM
Edited by: [email protected] on Sep 12, 2008 8:32 AM
Edited by: [email protected] on Sep 12, 2008 8:33 AMIf you have a local html file, or open an image locally from the menu, then yes, it works, but with web pages that are served from a remote location (web server), security kicks in and prevents the web page from accessing local files (and files on a networked drive).
you will either have to put the image on the web server and access it through http, or you can load it into the database/workspace images and access it that way. -
Can't phone all contacts from Mac with Yosemite.
I can't phone all contacts from my Mac with Yosemite. Some of the audio icons are greyed out. Any solutions?
hmmmm....*strokes beard*
I'm assuming you want to transfer all your contacts between sim and phone memory all at once.
to do this, go to contacts on your phone then select "options", then select "Mark\Unmark". You then get a little side menu. in this side menu select "Mark All". all you phone contact should now have ticks next to them. Now Press "Options" again and now you should have the option to "Copy to sim Directory". and from sim to phone do this in reverse.
Peace out
The Bearded One -
Displaying image from Database with php
Hello everybody,
I'm working on a website that displays videos courses and tutorials as my final project
and I'm working with "Flash builder 4" the database with mySQL and the application server with php
Basically, the goal is to display a datagrid that shows the manager of the website in column all the information stored on the "Course" table
the structure of the table is :
Course (id,img,src,title,description)
-id : primary key
-img : path to a photo of course {for example picture of JAVA}
-src : path to the playlist file {xml file}
-title : String
-description : String too
I already succeeded to display all these contents on a DataGrid, but not with the image, I couldn't display an imageon its column using the path stored on the database, I used a DataRenderer to do that, and here is my code for Renderer and the DataGrid.mxml
CourseGrid.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:courseservice="services.courseservice.*">
<fx:Script>
<![CDATA[
import Renderers.CourseDeleteRenderer;
import Renderers.CourseImageRenderer;
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
getAllCourseResult.token = courseService.getAllCourse();
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getAllCourseResult"/>
<courseservice:CourseService id="courseService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:DataGrid x="10" y="10" id="dataGrid"
creationComplete="dataGrid_creationCompleteHandler(event)"
dataProvider="{getAllCourseResult.lastResult}"
width="100%">
<mx:columns>
<mx:DataGridColumn headerText="" dataField="img" sortable="false" itemRenderer="Renderers.CourseImageRenderer"/>
<mx:DataGridColumn headerText="id" dataField="id"/>
<mx:DataGridColumn headerText="src" dataField="src"/>
<mx:DataGridColumn headerText="title" dataField="title"/>
<mx:DataGridColumn headerText="description" dataField="description"/>
<mx:DataGridColumn headerText="Delete" itemRenderer="Renderers.CourseDeleteRenderer"/>
<mx:DataGridColumn headerText="Update" itemRenderer="Renderers.CourseUpdateRenderer"/>
</mx:columns>
</mx:DataGrid>
</s:Application>
CourseImageRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true">
<mx:Image source="{data}" width="60" height="60"/>
</s:MXDataGridItemRenderer>
Result :
Problem :
How can I access to the path of the image, I tried to write "data.img" instead of "data" as img is the name of the column in the database that stores the path but it wasn't successful.
I know that it not complete statement "data" because "data" is a reference to what the DataGrid provides of information that gets from the (CreationComplete) event.
Question :
- Can you please help me with this so I can complete displaying images by accessing to what is on the column in tha DB so I can manipulate my datas that is stored there ?
==> I still have some questions about the buttons to update and delete datas fomr the DataGrid, but, until now I need to access successfully to the photo and display it
Thank you,Anyone that can help me with this ?
Please, try this with me, I'm asking Flex developpers this might be easy for you !
It's just question of how to access the string stored in the variable "data", when I used XML I just type the path to the repeated element like this :
XML file :
XML File
<parent>
<child>
<repeated_child></repeated_child>
<repeated_child></repeated_child>
<repeated_child></repeated_child>
</child>
</parent>
I used a Model as a reference to the xml file
and an arrayList as a container of the repeated child
I just write in the code "data.parent.repeated_child" to access the text in the "repeated_child"
and here is the code, that I implemented to generate videos from xml file to display a video play list
Video Playlist code(extract from XML file "data.xml")
<fx:Declarations>
<fx:Model id="model" source="assets/data.xml"/>
<s:ArrayList id="products" source="{model.video}"/>
</fx:Declarations>
<mx:List dataProvider="{products}" labelField="title"
change="list1_changeHandler(event,List(event.currentTarget).selectedItem)" x="103" y="77" height="350" width="198"/>
That was my goal to do that with the database.
Please help me
If you have other solution I still need it.
Thank you, -
How to display an image from database
Hi all,
I've saved an image(jpeg file) as BLOB item in the database through the forms.I need to fetch that particular image from the database and display the image in the report.How can i do that?
I tried to fetch the column from the database and added a text item and selected the PHOTO column , the properties has changed once i selected the BLOB item.File format I changed to Image , But the width is 4 and I'm not able to change that.
While executing I'm getting two errors,
REP : 0069 Internal Error
REP : 62203 Internal Error reading the image - Unable to render RenderedOp for this operation
Please help me to solve this issue.
Thanks in advance...Hello,
Try to revert to the "old" way to render images :
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/envvars/envvar_reports_default_display.htm
To revert to the dependency on DISPLAY and use screen fonts (old font look up algorithm):
Set REPORTS_DEFAULT_DISPLAY=NO.
Remove the screenprinter.ppd entry in the uiscreenprint.txt file.
Set the DISPLAY variable to the active X-Windows display surface.
Regards -
How can I read the image from database into form
hi everyone
if I have table like this
create table test
(id number(10),
pic long raw);
in this table record
in form If I have block non database
how can i read the image into non database item
I try with this code but no good
select pic into :photo from test where id=5;
photo its non database item kind image
how can i invoke image into item
thanks aloooooootHello,
You can't select image with select query. You need to create another database block from test table which has item binds with database pic column. Now in where condition in test block's property you have to write id=5. Change test block's properties UPDATE ALLOWED, INSERT ALLOWED, DELETE ALLOWED to NO. Only Query allowed property set to YES.
Now in your particular trigger write the code
GO_BLOCK('test');
Execute_Query;
please mark if it help you or correct
Regards,
Danish -
Can you display 4 addresses from database per page from Excel?
ok, to be more specific...
I have a 4.25 x 5.5 postcard that I want to print 4 to a page. I also have an Excel database with mailing address. Im well aware how to have addresses print into my document doing a mail merge but Im only aware of this working with one address per page. What Im doing is 4 different addresses per page. Is this possible?Thanks, this will be VERY handy in the future! Mail merge programs are such a ******* pain but ID makes it a heck of a lot easier!
One more question, I tried a test with a 5.5 x 4.25 card with address fields in the middle. I dropped it on the top left of an 8.5 x 11 layout and told it in the options to not resize anything. I ran the merge and it did put 4 different address for each page on about 5 pages. That is exactly what I wanted. It was giving me a message when I did it this way or when I was practicing and doing it wrong that I didnt understand what it meant, "No overset text was generated when merging records". Everything seemed to work properly so what does this mean? -
InDesign CS4 (ver.6) can not package all images from afp mounted server
I'm experiencing an issue on multiple Intel Mac's running OS 10.6.8 when packaging files some of the server based art does not collect.
In some folers some of the art collects and in the same folder some other files don't.
The missing files are generally .jpg or .eps and it's a combination of these files that are not being collected.
Images are sometimes shared between users but the missing images do not appear to be open elsewhere.
The docuemtns are stored across several AFP mounted server hosted on a Windows 2004 Server running ExtremeZIP to allow AFP cpnnection.
Moving the files to different volumes on the server does not appear to resolve this issue.
Any thoughts or questions? Apologies if this isn't clear.I just had this happen again with a new InDeslgin CS4 file, I took the missing images and relinked them to a new folder I just created on my desktop and it still does nt collect these files. So not only the server, but now my desktop, and it's not just my computer, I can reproduce on other macs in 10.6.8
I convertd the files from .EPS (from Photoshop: they're flattned) to .PDF (from Apple Preview) and relinked them, and I was not able to package either.
I did find the solution:
I checked off "Include Fonts and Links Hidden and Non-Printing Content"
even though these items were on visible layers and not on the pasteboard they were excluded before I checked it off.
Thanks for your help! -
REP-51096 printing image from database with web layout on an AIX server
I’m trying to run a report (web_layout) that load images (blob) from the database but I got the message:
javax.servlet.jsp.JspException: purge_calls:1446 reason=1 state=5
I checked the reports server log and the job status is “Terminated with error: <br>REP-56109: Job 14 is terminated due to connection timeout.”
Could anyone help me? Thanks in advance.
Edited by: luhmann on 08/01/2010 04:00I’m trying to run a report (web_layout) that load images (blob) from the database but I got the message:
javax.servlet.jsp.JspException: purge_calls:1446 reason=1 state=5
I checked the reports server log and the job status is “Terminated with error: <br>REP-56109: Job 14 is terminated due to connection timeout.”
Could anyone help me? Thanks in advance.
Edited by: luhmann on 08/01/2010 04:00 -
Mac can't display some images from Windows .doc files.
I've opened .doc files written in Windows Word in Pages 2009, Mac Word 2008 and Mac Word 2011 and they all fail to show some of the images within these documents. When I open these files in Windows Word, they show up just fine. Why aren't the Macs showing them properly?
Try downloading OpenOffice or LibreOffice and opening them in one of those. They do a better job of importing Word documents than Pages. Once you've got them open, you can save them as RTF and load them into Pages. Pages is nicer to work with, but OO/LO (basically the same application) has better features.
-
Retrieve multiple images from database to servlet
Hi there,
I try to retrieve more than one images from database to Servlet/JSP . However, I get only one images in the result set. Here is my code. Please Help .
How do I display more than one images ( multiple rows ) from database to Servlet ?.
When I retrieve, I got 3 rows of binary data, but I don't know how to display it on the Servlet/JSP pages.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import java.sql.*;
import com.sybase.jdbcx.*;
public class RetrievePhoto extends HttpServlet {
static ResultSet rs;
static CallableStatement NGSstmt = null;
static Connection NGScon = null;
static SybDriver _driver = null;
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {
ServletOutputStream os = res.getOutputStream();
String driver = ""
String URL = "";
String Host = "";
String UN = ""; //assign your username here
String PW = ""; //assign your password here
try {
Class c = Class.forName( driver );
_driver = (SybDriver) c.newInstance();
DriverManager.registerDriver( (SybDriver) _driver );
NGScon = DriverManager.getConnection( URL + Host, UN, PW );
} catch ( SQLException e ) {
os.println( "Unable to load the Sybase JDBC driver. " + e.toString() );
e.printStackTrace(System.out);
} catch (java.lang.Exception ex) {
// Got some other type of exception. Dump it.
os.println("Exception - java lang " + ex.getMessage() );
String PID = req.getParameter("PID"); //passing parameters from Servlet
try {
String SQLcmd = "{call RET_PHOTO_BY_PID(?)}";
NGSstmt = NGScon.prepareCall( SQLcmd );
//execute the query
synchronized (NGSIDBstmt)
NGSstmt.setString(1, PID); //passing parameter to store procedure
rs = NGSstmt.executeQuery();
byte[] stuff = new byte[1024];
int bytesRead = 0;
res.setContentType("image/gif");
InputStream is = null;
// Get the first row
while( rs.next() ) {
is = rs.getBinaryStream("PHOTO");
res.setContentLength(is.available());
for (int i=0;; i++) {
bytesRead = is.read(stuff);
os.write(stuff);
if ( bytesRead == -1 ) break;
rs.close();
os.flush();
os.close(); //close outputstream
} catch ( SQLException sqle) {
os.println("Error in SQL2Exception" + sqle.getMessage());When I retrieve, I got 3 rows of binary data, but I don't know how to display it on the Servlet/JSP pages.I will pick this bit of your post, because you seemed to have several partly-overlapping questions.
You are going about this wrong. You need to decide what your HTML will look like before you start writing servlet code. In this case you want to have something like a table, with an image in each row, right? Now what does the HTML for that look like? It's a <table> element, and so on, but what about the images? Well this is HTML, so it can't contain the binary images. It has to contains links to the images, and the browser will download the image from each of those links and put all of the downloads together into the page it displays.
That means you can't do it all with one servlet. You need a main servlet that generates the HTML, with the <table> element and the links to the images. Probably you need some DB calls here to find out how many images you're going to have, but you don't need to get them in this servlet. You just need to generate a link for each of them.
Then you need a second servlet that gets an image. It's going to get a single row from the DB and return the binary image you read from that row. Make sure to use "image/jpg" or whatever's appropriate instead of "text/html" in your response's content type here.
I will leave you to carry on from here. First step is to design the HTML that your main servlet will produce; remember that the links it generates need to carry enough information for the second servlet to be able to find the right image in the DB.
PC² -
I cant back up my all data from database
how can i take backup my all data from database with large object library (blob)
when i want back up i writing this statement on "cmd"
exp dbas/dbas@ddds file=D:\dms\ddfm.dmp
so it's only just backup data without large object library, any table contain large object library it can't take it
so i would like take backup all data from databaseOracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
and i am used win7 32bit
when i want back up i writing this statement on "cmd"
exp dbas/dbas@ddds file=D:\dms\ddfm.dmp
so it's only just backup data without large object library, any table contain large object library it can't take it
so i would like take backup all data from database
Edited by: 940639 on Jun 27, 2012 12:35 AM -
How to get all images from folder in c#?
I am trying to get all images from folder. But it is not executing from following:
string path=@"C:\wamp\www\fileupload\user_data";
string[] filePaths = Directory.GetFiles(path,".jpg");
for (int i = 0; i < filePaths.Length; i++)
dataGridImage.Controls.Add(filePaths[i]);
Please give me the correct solution.How to display all images from folder in picturebox in c#?
private void Form1_Load(object sender, EventArgs e)
string[] files = Directory.GetFiles(Form1.programdir + "\\card_images", "*", SearchOption.TopDirectoryOnly);
foreach (var filename in files)
Bitmap bmp = null;
try
bmp = new Bitmap(filename);
catch (Exception e)
// remove this if you don't want to see the exception message
MessageBox.Show(e.Message);
continue;
var card = new PictureBox();
card.BackgroundImage = bmp;
card.Padding = new Padding(0);
card.BackgroundImageLayout = ImageLayout.Stretch;
card.MouseDown += new MouseEventHandler(card_click);
card.Size = new Size((int)(this.ClientSize.Width / 2) - 15, images.Height);
images.Controls.Add(card);
Free .NET Barcode Generator & Scanner supporting over 40 kinds of 1D & 2D symbologies.
Maybe you are looking for
-
I bought Acrobat XI Pro, after two unsuccessful installations and then final successful one the program would not start, it asks me to buy it again or to type a serial number of the product, which I don't have. Help, please
-
Dear Gurus, We are using CRM 5.0 standalone and we want to implement CRM Billing for CRM-created standard sales orders. We have done the following: - Defined billing unit BP and assigned to corresponding sales area. - Defined billing type (F2) and ma
-
MacBook AIr usb ethernet slow when connected to second switch
Hi, We have MacBook Airs with 100 Mbps Apple USB ethernet adapters. We have managed Cisco switches for the LAN. We experience fast speeds when a USB etherenet/MacBook Air is connected directly to the switch. However... if we introduce a second switch
-
How do I search for unopened mail on iPad
Trying to filter for unopened mail on iPad. Any way to do this the way I can on MacBook Air?
-
I've something that has caused my desktop to be stretched. I have to keep moving back and forth to see the edges.I'm set at 1920 x1080, which I think is correct. I was using inDesign when this happened.