Dhanashree Mankar

Ranch Hand
+ Follow
since Aug 25, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dhanashree Mankar

Originally posted by Ali Gohar:
Still not understood
do you want to read the image file in form of byte[]?


I want to convert the image in binary form i.e 10101 And need to send it in file
20 years ago
I want to pass a binary form of image from servlet to user Image is already stored on server

Originally posted by Ali Gohar:
From where do you want to read the image? From File or From Database?

20 years ago
can anyone tell me what should i do to get the image in binary format
20 years ago
please help
20 years ago
following is my html file.
<BODY>
<img src="http:\\127.0.0.1:8080\examples\servlet\id2?id=1">
</BODY>
Servlet file:These r the 3 types by which i can send image to front end
1>String s = request.getParameter("id");
if (s.equals("1")){
String s1 = "http://www.az-maz.com/wall/fantasy/096.jpg";
PrintWriter out = response.getWriter();
out.println("<img src=\"" + s1 + "\">" );
}
2>public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
String s = request.getParameter("id");
if (s.equals("1")){
sponse.setContentType("image/jpeg");
URL yahoo = new URL("http://www.az-maz.com/wall/fantasy/096.jpg");
BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));
PrintWriter out = response.getWriter();
String input;
while((input = in.readLine()) != null){
out.println(input);
}
}
}
Getting the image but not in proper format
3>public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
String url=new String();
String s = request.getParameter("id");
if (s.equals("1")){
response.setContentType("image/jpeg");
url="http://www.az-maz.com/wall/fantasy/096.jpg";
File f = new File(url);
FileInputStream fin = new FileInputStream(f);
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(fin);
BufferedImage image = decoder.decodeAsBufferedImage();
ServletOutputStream sos = response.getOutputStream();
JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(sos);
encoder.encode(image);
}
}
But i am getting just a Small Cross in front end with 1 and 2.
Can anybody plz help me
thanx
<img src
20 years ago
If you wanted the first thing, and your Servlet is generating an image, there are various ways to precache images. I would suggest you search the Integer for various solutions.

Can u plz tell me what is Interger for various solutions?
20 years ago
I want the first thing. I want to catch the image sent by servlet everytime when client go for html page.Means that servlet should get automatically loaded.

Originally posted by Nathaniel Stoddard:
Dhanashree,
Do you mean that you want the Servlet's generated results to be cached in the client's browser so it is loaded faster next time it is accessed? Or do you mean that you want the Servlet to be loaded into the web container initially so that the very first time it is accessed the client doesn't have to wait while the ClassLoader finds the resource and loads it all into memory?
If you wanted the first thing, and your Servlet is generating an image, there are various ways to precache images. I would suggest you search the Integer for various solutions. I'm going to assume that you want the second solution. In that case there is an auto-load deployment descriptor you can use to achieve what you want:

Does that answer your question?

20 years ago
I want the servlet to be auto loaded.
following is my html:
<img src="servlet file?id=1">
now whenever i load my html file ,i want that servlet file should get automatically loaded
So which HTTP method i can use?
plz help
20 years ago
There is an url repesenting image in database. I want to fetch the url and then pass that as an image to client
response.setContentType("image/gif")
OutputStream out= response.getOutputStream()
But how to send that to client?
do i need to use GifEncoder? if yes then how?
20 years ago
How to send a response as binary file or image?
20 years ago
API
what is the meaning of API(application programe Interface)
And which API we use for core java?
can someone suggest me a good link about how to integrate jsp,servlets and jdbc together?
20 years ago
JSP
my servlet file is in
C:\tomcat4\webapps\examples\WEB-INF\classes\coreservlets\parameters.java
and html file is in
C:\tomcat4\webapps\forms\parametersform.html
Then i tried to access this form as follows
127.0.0.1:8080/forms/parametersform.html
it gives 404 error
Html file has action as follows:
<form action="/servlet/coreservlets.parameters">
plz help
20 years ago
This is my url:
String url = "jdbc racle:thin:@host123:1521 RCL";
This is my TNSNMAES.ORA entery:
CMEXAMPLE.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host23)(PORT = 1521))
)
(CONNECT_DATA = (SID = ORCL))
(SOURCE_ROUTE = yes)
)