How to display images on local disk(outside of WebContent of WAR) in jsp?
In a web application, I want to display images on local disk(outside of WebContent of WAR) in jsp. I couldn't put it in "WebContent/images/" because the images are portraits of users and they could be changed dynamically. If I put images in "WebContent/images/", I have to transfer the images back and forth every time when I update my WAR file.
Obviously, in jsp, something like
"<img src="/home/username/images/local/PRTR.jpg" />"
doesn't work.
Is it durable to store the images at somewhere else like "/home/username/images/local/" in the server's local disk?
Hi aiGrace,
You have to transform your file path into the appropriate URL, this way :
try {
File file = new File("D:/Test/MyPic.jpg");
System.out.println(file.toURI().toURL());
} catch (MalformedURLException ex) {
ex.printStackTrace();
}Then, you insert the URL in your img tag.
Similar Messages
-
How to read images from local hard disk and display in tile layout
Dear Folks,
I have 100 images in a folder @ local hard disk (E drive).
I would like to display them in Tile view of 3X3.
I have options (Radio buttons) to chnage the layout at runtime to 4X4 , 5#5 and 6X6.
Also when the change in layout happens, I wanted to make use of backgroudLoading of image view so that user do not want to wait till the entire tile loads.
How do I achive this requiremet?
Sample code if any of great help. Thanks in advance.
Edited by: JavaFX_Duo on Jul 9, 2009 12:02 PM1. So I would like to know which is the {color:#3366ff}best way to load local images in ImageView{color}.I'm no expert, but is there a reason that you are using Swing to do the loading?
2. secondly, currently the system displays all images only after the completion of creating all images. {color:#3366ff}How to display images as and when they are created.{color} So that the user has a feeling that the images are loading.JavaFX Image class let you display a lightweight placeholder, and you can bind the progress to some kind of visual indicator. I don't think you can display an image that is partially loaded.
def PATHS: String[] = [
"C://Ariel Atom//ariel-atom-1.jpg",
"C://Ariel Atom//ariel-atom-2.jpg",
"C://Ariel Atom//ariel-atom-3.jpg",
"C://Ariel Atom//ariel-atom-5.jpg"
function getImage(path: String): Image {
Image {
url: "file:///{path}"
backgroundLoading: true
Stage {
title: "Image Tiles"
width: 1024
height: 800
scene: Scene {
content: [
Tile {
columns: 2
tileWidth: 400
tileHeight: 400
content: for (i in [0..3]) {
ImageView {
image: getImage(PATHS) -
How to display images on my internal isight?
Hi,
I just bought the new iMac 2 gig dual. Running on 10.5.2.
I wanted to know how to display images on my screen during a video conference chat without resorting to holding up a print out to the camera? I need something where I can switch from video mode to image mode and show a single image at a time if I need to. All that while still talking of coarse. If it isn't possible with my iSight software, can you point me to other software I can download and still use my built in cam?
I hope I was clear enough in asking this.
Thanks
LibanWelcome to Apple Discussions, Liban
iChat can do what you want, but I do not know of any web-based video chat site that can.
Look for Help or Support information on the site you are using or ask the Webmaster if his site has the capability to do what you want.
EZ Jim
PowerBook 1.67 GHz w/Mac OS X (10.4.11) G5 DP 1.8 w/Mac OS X (10.5.2) External iSight -
Hi all,
How to display image from the database table in the adobe form by using web dynpro abap?
I want to display image in the adobe interactive form by using web dynpro abap.
Please help me.
Regards,
sriniHi Srini,
If you go through the article you might have seen the following piece of code
*** Send the values back to the node
lo_el_z_if_test_cv->set_static_attributes(
EXPORTING
static_attributes = ls_z_if_test_cv ).
" here ls_z_if_test_cv has the image in XSTRING format which has beeen retrived using METHOD get_bds_graphic_as_bmp of CLASS cl_ssf_xsf_utilities
" In your case you need to just use the select query n fetch it from your table; ( provided your image is store in XSTRING format )
How is your image stored in your database table ?
Regards,
Radhika. -
How to display images and information
how to display images and information(e.g. like questions) on a jsp page that stored in a database
Look As far as i can see....
Utlimately every file could be expressed as a bytes buffer.
so say if you have a bean called Choice Bean which is expressed as
public class ChoiceBean{
private String choiceid;
private String choicedesc;
private byte image[];
public void setChoiceId(String choiceid){
this.choiceid = choiceid;
public String getChoiceId(){
return this.choiceid;
public void setChoiceDesc(String choicedesc){
this.choicedesc = choicedesc;
public String getChoiceDesc(){
return this.choicedesc;
public void setImage(byte image[]){
this.image = image;
public byte[] getImage(){
return this.image;
}QuestionList.java:
===============
public class QuestionList{
private List<ChoiceBean> choicelist;
/*Other member variable declarations*/
public List<ChoiceBean> getChoiceList(){
/*Custom code where you may build the list by querying the DA layer*/
return this.choicelist;
public int search(String choiceid){
int index = -1;
for(int i =0 ; i < this.choicelist.size() ; i++){
ChoiceBean cb = this.choicelist.get(i);
if(cb.getChoiceId().equals(choiceid)){
index = i;
break;
return index;
/* Other member method declarations */
}and you are retreving List<ChoiceBean> from DB using your query & have created a session attribute / <jsp:useBean> named ChoiceList
NOTE: sometimes your application server can go out of bounds as you are consuming a lot of memory by creating an arraylist object.
use the following methodology to display images & choices
sample.jsp:
=========
<jsp:useBean id="QuestionList" class="com.qpa.dao.QuestionList" scope="session"/>
<TABLE>
<%
/* QuestionList.getChoiceList() is a method which fetches data from the DB & returns it in form of List<ChoiceBean> */
List<ChoiceBean> choicelist = QuestionList.getChoiceList();
for(int i =0 ; i < choicelist.size() ; i++){
%>
<TR>
<TD><%!=choicelist.get(i).getChoiceId()%></TD>
<!-- calling servlet which renders an images in JPG format based upon given choiceid(unique field) -->
<TD><IMAGE src="ImageServlet?choiceid=<%!=choicelist.get(i).getChoiceId()%>"/> </TD>
<TD><%!=choicelist.get(i).getChoiceDesc()%></TD>
</TR>
<%
%>
</TABLE>
<%
session.remove("QuestionList");
%>
NOTE: usage of JSTL or any other custom built tag-libraries makes life more simpler in the following case
ImageServlet.java:
===============
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
byte buffer[] = null;
HttpSession session = request.getSession(false);
/*getting the QuestionList from the session*/
QuestionList ql = null;
String choiceid = new String("");
try{
choiceid = request.getParameter("choiceid");
/*getting the QuestionList from the session*/
ql = (QuestionList) session.getAttribute("QuestionList");
} catch(Exception exp){
if(choiceid.equals("") == false && ql != null ){
List<ChoiceBean> clist = QuestionList.getChoiceList();
assuming that you have created a serach method which searches the entire choice list and would give you
the index of that object which is being refered by unique choiceid and returns -1 if not found
int index = QuestionList.search(choiceid);
if(index != -1){
ChoiceBean cb = clist.get(index);
buffer = cb.getImage();
if(buffer != null){
// assuming that we have stored images in JPEG format only
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(buffer));
BufferedImage image =decoder.decodeAsBufferedImage();
response.setContentType("image/jpeg");
// Send back image
ServletOutputStream sos = response.getOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
encoder.encode(image);
} else {
response.setContentType("text/html");
response.getWriter().println("<b>Image data not found</b>");
}However,i still feel there are few loopholes with this approach where Application Server can eat up a lot of heap space which may result in outofmemorybound exception.
Hope this might help :)
REGARDS,
RaHuL -
How to read bytes(image) from a server ?how to display image after read byt
How to read bytes(image) from a server ?how to display image after reading bytes?
i have tried coding tis , but i couldnt get the image to be display:
BufferedInputStream in1=new BufferedInputStream(kkSocket.getInputStream());
int length1;
byte [] data=new byte[1048576];
if((length1=in1.read(data))!=-1){
System.out.println("???");
}System.out.println("length "+length1);
Integer inter=new Integer(length1);
byte d=inter.byteValue();didn't I tell you about using javax.imageio.ImageIO.read(InputStream) in another thread?
-
How to display image in the smartforms
Hi All,
I have image conent in the Binary formate.I want to dispaly that image in the smartforms.
Please tell me how to display that image in the smartforms dynamically.
Normally wa uploaded in SE78.And that is used in smartforms.But this is static way.
I want to display tha images dynamically.
Please Please
Thanks,
SarithaHi,
The image is in the DB ,right..Its in Binary format..
See first we want the picture to be get uploaded inside the SAP.It is done by se78..
If possible we can retrieve the picture outside in a place means we can get tht into sap by using
Call Transaction 'SE78'.
Reward if useful ........... -
How to display image and data in module pool screen?
Hi,
I want to display image and relevant data besides the image in module pool screen, I am using docking container to display the image.
Actually I am able to display image or data any one but not both.
one more thing I want to display multiple images and their data.
Please suggest some one if you have any idea.
Regards,
Dileep.You can try below way, I have used in report.
DATA: gc_docking TYPE REF TO cl_gui_docking_container, "#EC NEEDED "Docking Container
gc_split TYPE REF TO cl_gui_easy_splitter_container, "#EC NEEDED "Splitter
gc_top_container TYPE REF TO cl_gui_container, "#EC NEEDED "Top Container
gc_bottom_container TYPE REF TO cl_gui_container, "#EC NEEDED "Bottom Container
gc_document TYPE REF TO cl_dd_document, "#EC NEEDED "Document
gc_events TYPE REF TO lcl_event_class, "#EC NEEDED " Local Event Class
gc_grid TYPE REF TO cl_gui_alv_grid, "#EC NEEDED " ALV Class
" Creating Docking
CREATE OBJECT gc_docking
EXPORTING
ratio = c_95.
IF sy-subrc EQ 0.
* Splitting the Docking container
CREATE OBJECT gc_split
EXPORTING
parent = gc_docking
sash_position = c_10 "Position of Splitter Bar (in Percent)
with_border = c_1. "With Border = 1 Without Border = 0
ENDIF.
* Placing the containers in the splitter
gc_top_container = gc_split->top_left_container .
gc_bottom_container = gc_split->bottom_right_container .
* Creating Grid
CREATE OBJECT gc_grid
EXPORTING
i_parent = gc_bottom_container.
ELSE.
* Background job handling
CREATE OBJECT gc_grid
EXPORTING
i_parent = gc_docking.
ENDIF.
* Creating the document
CREATE OBJECT gc_document
EXPORTING
style = 'ALV_GRID'.
Regards,
Sameer -
How to display images in a Jtable cell-Urgent
Hay all,
Can anybody tell me that can we display images to JTable' cell,If yes the how do we do that(with some code snippet)? Its very urgent .Plz reply as soon as possible.Here is an example
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
class SimpleTableExample extends JFrame
private JPanel topPanel;
private JTable table;
private JScrollPane scrollPane;
public SimpleTableExample()
setTitle( "Table With Image" );
setSize( 300, 200 );
setBackground( Color.gray );
topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );
// Create columns names
String columnNames[] = { "Col1", "Col2", "Col3" };
// Create some data
Object data[][] =
{ (ImageIcon) new ImageIcon("User.Gif"), (String) "100", (String)"101" },
{ (String)"102", (String)"103", (String)"104" },
{ (String)"105", (String)"106", (String)"107" },
{ (String)"108", (String)"109", (String)"110" },
// Create a new table instance
DefaultTableModel model = new DefaultTableModel(data, columnNames);
JTable table = new JTable( model )
public Class getColumnClass(int column)
return getValueAt(0, column).getClass();
}; // Add the table to a scrolling pane
scrollPane = new JScrollPane( table );
topPanel.add( scrollPane, BorderLayout.CENTER );
public static void main( String args[] )
SimpleTableExample mainFrame = new SimpleTableExample();
mainFrame.setVisible( true );
} -
How to display images in a table column?
Hi,
In a VC model, I have to display images in a table column for each record found.
How can this be done?
Regards,
NitinHi Nitin,
It can be done by adding to the table the Image control (can be found under Advanced Controls in the Compose panel).
In the URL property (in the Configure panel of the Image control) you can define any expression that will return the image URL. For example:
="http://hosting.site.url/"&@ImageNameField
Regards,
Udi
Edited by: Udi Cohen on Jun 11, 2008 1:39 PM -
How to display images in TextArea? and how to make some of the text clickab
1) How do i make TextArea display images?
(example a client program, where people chat, put :) and get a smily image)
2) For example if text is http://www.something.com in textArea, a person can click it, and my custom dialog will apear saying something about this link.......This has been discussed very many times! It is solvable. Search the forum!
one way is to make a custom textarea extending Canvas, and painting the text in the paint() method. You need a paint method with drawString and drawImage calles to make it the way you describe it. You also need to add a MouseListener for detection of clicking. -
Display Image from Local path "c:\image.gif"
Hi Experts,
Is there anyway to display an image from local path i.e "c:\img.jpg".
I need to display an image from the path in Dialog(Screen) programming.
I need to do it using program not any other way...
Can anyone suggest me a method please.
Thanks
Regards
NaveenHi Naveen,
You'll have to create a custom control for this and perform coding like this:
data piccon type ref to cl_gui_custom_container.
data my_piccon type ref to cl_gui_container.
data my_pic type ref to cl_gui_picture.
data my_container type ref to cl_gui_container.
* invoking the static attribute of the class.
my_container = cl_gui_container=>default_screen.
create object piccon
exporting
parent = my_piccon
container_name = 'IMG_CON'
* STYLE =
* LIFETIME = lifetime_default
repid = sy-repid
dynnr = sy-dynnr
* NO_AUTODEF_PROGID_DYNNR =
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
create object my_pic
exporting
* LIFETIME =
* SHELLSTYLE =
parent = piccon
* NAME =
exceptions
error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
* Can be used to load the picture from the presentation server.
call method my_pic->load_picture_from_url
exporting
url = 'file://D:mydataPicturesMisc_pics 1fw1.jpg'
* IMPORTING
* RESULT =
exceptions
error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Display Image from Local p"ath c:\image.gif"
Hi Experts,
Is there anyway to display an image from local path i.e "c:\img.jpg".
I need to display an image from the path in Dialog(Screen) programming.
I need to do it using program not any other way...
Can anyone suggest me a method please.
Thanks
Regards
NaveenWell you could use the HTML control - try program SAPHTML_DEMO1 and key in the c:\img.jpg to check it works for you... or the picture control as used in example SAP_PICTURE_DEMO.
Jonathan -
How to display image in database using php
i've try search all hope that you all can give me some guidance how to display data that is in image or BLOB using PHP. just a query and php code that will make display of the image. hope that you all show me the example or give me reference that i need to solve my problem.
Hi,
Have a check on these Google results, you might find something there...
http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&q=%22display%20image%22%2Boracle%20%2Bphp -
How to Display IMAGE BLOB stored in a table in a html region APEX
Need to know how to display an image stored in a table in a HTML APEX Region.
PleaseHi
Please explain what you mean by it doesn't work?
Are there errors messages, at what point, how far did you get and exactly what did you do????
Please provide more information.
Thanks
Ben
Maybe you are looking for
-
Cinema Display to a MacBookPro. DVI versus Mini-Port.
Hello, Wanting to hook up a Cinema Display to a MacBookPro Intel Duo with the DVI port (not Mini-Port. Not Thunderbolt). Is there an adapter that converts the DVI config to work with a Cinema Display with a Mini-Port connector or do I need the versio
-
Inadvertantly added music files to the wrong library
I created a 2nd library in itunes and then inadvertantly added music files to it instead of to the original library. My original intent was to move files from the 1st library to the 2nd but I forgot we had added music that hadn't been scanned into it
-
App File Server connection error when trying to run a BI Publisher report..
hello Gurus... As above - App File Server connection error when trying to run a BI Publisher report.. FOR THE FIRST TIME. What does our DBA need to do..? error message reads.. Template code: SUARXASR Template app: AR Language: en Territory:
-
I am out of the country and using an older laptop that has 10.6.8 installed on it. I also have 2 versions of Pages installed on this laptop (2.0.2 and 4.0.5). I was attempting to open some Pages files that I had created on my Mac (10.10), but got th
-
Address Book contact preview shows a different date than what is input in the birthday field.
When opening the address book and clicking on an entry, the preview pane at the bottom shows a different date than the date that is entered in the birthday field. It shows the day before the actual date that is entered. See images below: Thanks!