How to display servlet dynamically generated image ?
Hi,
How to display servlet dynamically generated image ?
I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
**Try n# 1 **************************************************************
This displays my image but nothing elle :
ServletOutputStream sos = pResponse.getOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
encoder.encode(img);
**Try n# 2 ****************************************************************
I tried also :
In the servlet :
request.setAttribute("renderedImage", img);
and in the jsp page :
BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
<img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
This last try draws big crap in the jsp page, thank you in advance.
Nelson
Call another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).
Similar Messages
-
Handling dynamically generated Images
Hello,
I have a WDJ application that generates Images dynamically based on certain criterion. The dynamically generated images are put to the server using the code
BufferedImage image = <rendered image ...>
File outFile = new File( "Output.jpg") ;
ImageIO.write( image, "jpg", outFile);
/** Resource path is not set during the file creation
* as ImageIO throws IllegalArgumentException
It gets saved to the folder <i><drive>\usr\sap\<SID>\JC<InstNo>\j2ee\cluster\server0\output.jpg </i> by default.
Now, how to show up this dynamically generated image in a Image UI element? I have tried setting the output file name to the attribute that is bound to the "Source" property of the Image UI element but it doosn't show up as WD runtime is doing a look-up in the folder <i>../../../resources/com.test/<projectName>/Components/com.test.<componentName>/</i>
Any pointers in this regard are highly appreciated.
BalaHi
Try this
Create the alias for the folder (C:\usr\sap\P13\JC00\j2ee\cluster\server0.)
1.Goto Visual Administrator->Http Provider->Aliases in the Runtime Tab.
2.Give the Alias Name and Path for the Folder.
3.The Image sorce like http://<Server>:<Port>/<Alias>/<image>.<ext>
Kind Regards
Mukesh -
How to display a dynamic image file from url?
Hey,I want to display a dynamic image file from url in applet.For example,a jpg file which from one video camera server,store one frame pictur for ever.My java file looks like here:
//PlayJpg.java:
import java.awt.*;
import java.applet.*;
import java.net.*;
public class PlayJpg extends Applet implements Runnable {
public static void main(String args[]) {
Frame F=new Frame("My Applet/Application Window");
F.setSize(480, 240);
PlayJpg A = new PlayJpg();
F.add(A);
A.start(); // Web browser calls start() automatically
// A.init(); - we skip calling it this time
// because it contains only Applet specific tasks.
F.setVisible(true);
Thread count = null;
String urlStr = null;
int sleepTime = 0;
Image image = null;
// called only for an applet - unless called explicitely by an appliaction
public void init() {
sleepTime = Integer.parseInt(getParameter("refreshTime"));
urlStr = getParameter("jpgFile");
// called only for an applet - unless called explicitely by an appliaction
public void start() {
count=(new Thread(this));
count.start();
// called only for applet when the browser leaves the web page
public void stop() {
count=null;
public void paint(Graphics g) {
try{
URL location=new URL(urlStr);
image = getToolkit().getImage(location);
}catch (MalformedURLException mue) {
showStatus (mue.toString());
}catch(Exception e){
System.out.println("Sorry. System Caught Exception in paint().");
System.out.println("e.getMessage():" + e.getMessage());
System.out.println("e.toString():" + e.toString());
System.out.println("e.printStackTrace():" );
e.printStackTrace();
if (image!=null) g.drawImage(image,1,1,320,240,this);
// called each time the display needs to be repainted
public void run() {
while (count==Thread.currentThread()) {
try {
Thread.currentThread().sleep(sleepTime*1000);
} catch(Exception e) {}
repaint(); // forces update of the screen
// end of PlayJpg.java
My Html file looks like here:
<html>
<applet code="PlayJpg.class" width=320 height=240>
<param name=jpgFile value="http://Localhost/playjpg/snapshot0.jpg">
<param name=refreshTime value="1">
</applet>
</html>
I only get the first frame picture for ever by my html.But the jpg file is dynamic.
Why?
Can you help me?
Thanks.
JoeHi,
Add this line inside your run() method, right before your call to repaint():
if (image != null) {image.flush();}Hope this helps,
Kurt. -
How to display html content with image in Adobe Flash and Flex mobile project?
Hi,
I have a html content with image in it. How to display it in Adobe Flash Builder and Flex mobile project? Which control needs to be used for this?Hello,
The only current way is to use an iFrame, or if you only need some html tags you could use the Text Layout Framework.
Here this is the iFrame approach:
http://code.google.com/p/flex-iframe/
If the swc do not work in Flex4 just use its ource code which works...
...it is basically based on this:
http://www.deitte.com/archives/2008/07/dont_use_iframe.htm
see also and vote, please:
http://bugs.adobe.com/jira/browse/SDK-12291
http://bugs.adobe.com/jira/browse/SDK-13740
Regards
Marc -
How to display the dynamic region in full size
Hi,
I'm not able to display the dynamic region in full size.
In my page, i attached a dynamic region which refers a page fragment. This dynamic region contents are showing as small (scroll is there but i want to display fully).
How to do this?
Thanks in advance,
SundarMore than likely it has something to do with your parent layout element. I'd suggest putting your region in an af:panelStretchLayout or similar container that stretches its children. Some of the elements can be a little tricky though, such as af:panelTabbed. It has an attribute that must be set to stretch its first child.
-
How to display Frame Dynamically
Hi friends,
Plz tell me How to Display / Hide or Frame Dynamically in Oracle Forms.
I am Using Oracle Forms 6i
Thanksthanks Francois......but i need to hide only one small frame dynamically......
Do you have any other Option...other than using a frame.....or a Frame alike.....
Thanks -
How to display the index generated by TREX?
We have a need to display the indexes generate by TREX for SM7.0 KM and EP7.0 KM.
Please help tell how to do it?
Thanks a lot!Hi Ashley jo,
Well, the above would not help in OS level.
The Design is, TREX always stores the indexed pointers to the actual data in it's database rather OS level.
But at OS level, you can find details about how TREX has been configured and managed.
The typical path would be <Drive>:\usr\sap\<SID>\TRX<Instance number>\<Host name>
In this path, you find all *.ini files which contains the configuration details apart from regular 'work', 'log', 'trace' directories.
Regards
Sekhar -
How to display the dynamic text in the selection screen
Hi All,
I want to display the dynamic text in the selection screen .... ( I searched in forums , didnt get the any answer fot this sort of qustion ).....
EX: If i have the date of today 31st it has to show message like " today date is 31 like some thing " when i execute the report .
Could any one face this sort of requirment, Please let me know.
Thanks in advance.
Reagrds,
BharaniWhere would you like this dynamic text being displayed? As an "message" or in some parameter field?
If first
parameters date type d.
data: text type string.
at selection-screen.
concatenate 'Today is' date into text.
message text type 'I'.
If second
parameters pa_text type c length 50.
at selection-screen on date.
if date is not initial.
concatenate 'Today is' date into pa_text.
enidf.
at selection-screen output.
"show it as read only
loop at screen.
if screen-name = 'PA_TEXT'.
screen-input = abap_false.
modify screen.
endif.
endloop.
Regards
Marcin -
How to send the dynamically generated XML file to other site for further processing?
I have a question regarding exchanging data between two systems
using XSQL servlet. The situation is descrbed as the follows:
Assume that we have a simple XSQL page named "emp.xsql"
<?xml version="1.0"?>
<?-- XSQL page file "emp.xsql" -->
<xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo" >
SELECT * FROM EMP
</xsql:query>
and we can access it through the HTTP request likes
http://web_server_name/xsql/emp.xsql.
Usually we will the returned dynamic XML file and show it on the
screen. Now the problem is that we don't want to show the
generated XML file on the calling screen. Instead, we want to
send the generated XML file to other website for further
processing, say, using JSP or ASP likes
http://other_web_server_name/XMLProcessing.jsp?.....
How can it be implemented using XSQL servlet?
Any hint and outline of the solution is appreciated.
ThanksIke,
Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
Please help me.
Thank you for your posting.
Padma. -
How to display content dynamically base on the menu selection?
I have only one XML file to populate my menus and display the
content base on the menu selection.
If I select anything by name on the menus, example Math all
the the Math products will display on the dsFeatures region.
I use istinctOnLoad: true, distinctFieldsOnLoad:['name']
function to remove duplicate rows from the data set when it loads.
So far so good.
Once I try to select from the grades menu this does not
display anything.
I'll need to dynamically change the dsFeatures.setPath when I
click on the menus some how.
dsFeatures.setXPath("products/product[grade =
'"+???+"']/features/feature");
Below is my code.
XML used to create the menus and the display the content.
<products>
<product>
<name>Math</name>
<category>Life Math</category>
<grade type="grade">Grade 6 - 8</grade>
<subject>Life Math Grade 6 - 8</subject>
<image>images/math_icon.png</image>
</product>
<product>
<name>Math</name>
<category>Division</category>
<grade type="grade">Grade 5</grade>
<subject>Life Math Grade 5</subject>
<image>images/math_icon.png</image>
</product>
<product>
<name>Science</name>
<category>Life Math</category>
<grade type="grade">Grade 6 - 8</grade>
<subject>Life Science Grade 6 - 8</subject>
<image>images/science_icon.png</image>
</product>
<product>
<name>Social Studies</name>
<category>Studies</category>
<grade type="grade">Grade 5</grade>
<subject>Social Studies Life Grade 5</subject>
<image>images/social_icon.png</image>
</product>
<product>
<name>Language Arts</name>
<category>Life Arts</category>
<grade type="grade">Grade 3 - 4</grade>
<subject>Life ArtsGrade 3 - 4</subject>
<image>images/language_icon.png</image>
</product>
</products>
// Get all the products data and use distinct() to filter the
names.
var dsProducts = new
Spry.Data.XMLDataSet("included/d_products.xml",
"/products/product", { useCache: false, distinctOnLoad: true,
distinctFieldsOnLoad:['name']});
// Get the menu by grade using distinct()
var dsByGrade = new Spry.Data.XMLDataSet(null,
"/products/product/grade", { useCache: false, distinctOnLoad: true,
sortOnLoad: "grade", distinctFieldsOnLoad:['grade'] });
// Create the dsFeatures data set, pass a null for the URL
parameter so that it doesn't load
var dsFeatures = new Spry.Data.XMLDataSet(null,
"/products/product[name = '{dsProducts::name}']/features/feature",
{ useCache: false });
// Define a function that to register as an observer on
dsProducts.
function updateCategoriesAndFeatures(notificationType,
notifier, data)
// Interested in "onPostLoad" notifications.
// If it is any other notification, just bail.
if (notificationType != "onCurrentRowChanged" &&
notificationType != "onPostLoad")
return;
// Received an "onPostLoad" or "onCurrentRowChanged
notification
// from dsProducts! Ask it for its XML document. If it has
one, tell
// dsFeatures to extract its data from that document.
var doc = dsProducts.getDocument();
if (doc)
if (notificationType == "onPostLoad")
dsByGrade.setDataFromDoc(doc);
dsFeatures.setDataFromDoc(doc);
// Register the function as an observer on dsProducts.
dsProducts.addObserver(updateCategoriesAndFeatures);
Menus:
Display by names:
<ul spry:region="dsProducts" id="nameRegion">
<li class="product" spry:repeat="dsProducts"
spry:setrow="dsProducts" spry:select="selected" spry:hover="hover"
>{name}</li>
</ul>
Display by grades:
<ul spry:region="dsByGrade" id="gradeRegion">
<li class="grade " spry:repeat="dsByGrade"
spry:setrow="dsByGrade" spry:select="selected" spry:hover="hover"
>{grade}</li>
</ul>
Content.
Display the features content:
<ul spry:region="dsFeatures">
<li spry:repeat="dsFeatures">{subject} <br />
{image}</li>
</ul>
Any idea on how to go about this or pointer to an example
would be appreciated.
~CheersDoes anybody have idea?
-
Hi all.... how to display tables dynamically in a JSP page
im trying to display the list of tables in MYSQL datbase into a JSP.... i have a database name link on the page.... once i click on that the list of tables should be listed dynamically in the page as a link...Also is it possible to click on each table link and go to see the table details ...if so how.... please some one help me ...its very urgent........
im trying to display the list of tables in MYSQL
datbase into a JSP.... i have a database name link on
the page.... once i click on that the list of tables
should be listed dynamically in the page as a
link...Also is it possible to click on each table
link and go to see the table details ...if so how....DatabaseMetaData has a method (look in the documentation) to get the list of tables. It also has methods to get information on specific database objects
please some one help me ...its very urgent........It's even urgent that you look in the documentation. -
How to Display Html Text with Image
HI Frens,
I am getting some html text from a source, Later i want to
display that data, but it may happened that it has some images in
it. Currently I am using text area to display it.
Now My question is if there is any image will it show, as we
can see it in our mails? if Not, Which component I should use for
this?
I also want that I need to select some file from, How can i
get open dialog box here?
Thks in Advance for replies frens:
Ashish MishraHi Ashish,
If I have understood your requirement properly, u want to
display html text on a flex application.
I think there its better if you use the html component to
display the text. I have a sample code which will give you a
direction to think on.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="initApp( )">
<mx:Script>
<![CDATA[
public function initApp( ):void
var initHtml:String = "<html><head> \
<title='Page Example'/> \
<body bgcolor='#ccddee'><h1>Page
Example</h1> \
<p>This is a complete <b>HTML</b> \
page as a
<em>string</em>.</p></html></body>";
this.html.htmlText = initHtml;
]]>
</mx:Script>
<mx:HTML id="html" width="100%" height="100%" />
</mx:Application>
Also do you want a file open dialog box?? -
How to display graphics dynamically in JSP
I use JSP to call a servlet to get the output . The output is in svg format. I do not hope to create a svg file to store the output from servlet. I wope to embed the svg dynamically in the jsp page
Anybody knows the solution. Many thanks in advance
Cheers,
.Because the output from Servlet is in text format not binary.
So the tag <IMAG></IMAG> does not work .
the output is similar as
<svg viewBox="0 0 360 270">
<style type="text/css"><![CDATA[
.aS{ font-family: monospace; text-anchor: middle;
font-size: 35px; stroke: Blue; fill: Red; }
]]></style>
<g>
<text x="60" y="90">+2%</text>
<polyline points=" 110,80 110,80 210,80 210,80" />
<text x="60" y="180">-2%</text>
<line x1="110" y1="170" x2="210" y2="170" />
<line x1="110" y1="120" x2="210" y2="120" />
<text x="280" y="130">4:0</text>
<text x="160" y="200">1</text>
<text x="110" y="150">-</text>
<text x="185" y="50">Sample - Name</text>
<text x="185" y="240">Minutes/km (2003/1/7)</text>
</g>
</svg>
If I keep the output as a **.svg file. then embed it in jsp. it is OK. -
How to Display RTF data with images from SQL database in Crystal Report
I am using Crystal report in my WPF application, I have generate Question Paper Report, in which have Question with images. Question with images are stored in SQL Server in rtf format, I want to generate Question report with RTF Text and Images in report
Hello Sir,
I am still Facing problem in Crystal report generation with RTF Data (Text + Images),
I am storing Questions in SQL Server which are RTF Format, Questions have Text + Images..
I changed field data type then also i didn't get image in Crystal report
if i browse an image n stored that in DB then its displaying in Crystal report, but when i pasted that image in RichTextBox and saved that in DB then no data displayed in Crystal report.
My Table Structure is
Table Name: tblQuestions
field : Questions Varbinary(max)
I tried with nvarchar(max) also but its aslo not working -
How to display iviews dynamically
Hi all,
I am making iView and attaching them to pages, however the iView is displayed with fixed size. Is there any option to display the height dynamically.
Could you please send details or documentation on how to control the size of the iview within a page...
your help is appreciated.
devHi Devara,
There is an option to control height of iview in page. Open the iView in property editor and in Appreance-size property category you will find property called height type change it to automatic.
PS: IF helpful awards points
--Deepak
Maybe you are looking for
-
Whether you use the Dashboard calculator widget or the Calculator that is built into the Apple OS as an application, there is no button for square root. If you are using the Calculator application you can toggle the interface from Basic to Scientific
-
My husband and I do not have separate e-mail addresses. Before he purchased an IPhone this was not a problem. Does we need two separate e-mail addresses to create two separate Apple ID's and register, maintain two separate IPhones?
-
Bought a mac mini and have music files from my old windows PC on a USB drive. need to know how to transfer all the music from the USB drive to itunes so I can sync them with my new ipod.
-
External Enclosure Not Recognized
Hi, I replaced my Powerbook G4's internal IDE HDD with a larger one, and put the old one in a USB external enclosure. I cloned the old hard drive onto the new one so my computer would be the same, but with more hard drive space. *I want to use the ol
-
ILife Support version 9.04 Link discovered
In regard to this archived thread: https://discussions.apple.com/message/11128704?tstart=0#11128704 I found the existing link for the disk image to download iLife Support version 9.04 for iLife version 2009. I hope this helps anyone. It helped me as