aspose file tools*
The moose likes Servlets and the fly likes Create Images from one servlet    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Create Images from one servlet    " Watch "Create Images from one servlet    " New topic
Author

Create Images from one servlet

Andrea De Gaetano
Greenhorn

Joined: Mar 26, 2008
Posts: 11
HI,
I've got a servlet called Master that call another servlet ImageGenerator with different parameter.
ImageGenerator is a servlet that use the "png/image" content-type to produce some chart image for Master.
In the code of the Master there are multiple sentence like:

out.println("<img src=\"ImageGenerator?image=1 >");
out.println("<img src=\"ImageGenerator?image=2 >");
out.println("<img src=\"ImageGenerator?image=3 >");

The obvious problem is that only the first call to ImageGenerator works good accordingly to the Servlet Lifecycle.

So , how can I find a way to call ImageGenerator multiple times?
Or, how can I find another way to handle this problem?
Thanks you
[ March 26, 2008: Message edited by: Andrea De Gaetano ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You write a web page to the client containing three images. The client requests each image separately, the IMageServlet gets called three times, once to cretae each image.

There are no lifecycle problems.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
make 3 different request.


Jigar Naik


Andrea De Gaetano
Greenhorn

Joined: Mar 26, 2008
Posts: 11
Originally posted by Jigar Naik:
make 3 different request.


mm ok . but How can I regenerate the request?
Thanks you
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

By building img tags (as you have done) you are causing the browser to make the requests (one for each img tag).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Andrea De Gaetano
Greenhorn

Joined: Mar 26, 2008
Posts: 11
Originally posted by Ben Souther:
By building img tags (as you have done) you are causing the browser to make the requests (one for each img tag).


so you said, the problem is in another point... right?
It's really strange because if I put a simple

System.out.println("call "+image);
(where image is the param received)


in the doGet(doPost call doGet) method of ImageGenerator it prints only the first sentence and not the other 2.

I have to find the problem...
Thanks for your attention.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I'm not sure what you're asking but did notice a bug in your code:



There is no close quote to your src attribute.
Andrea De Gaetano
Greenhorn

Joined: Mar 26, 2008
Posts: 11
Originally posted by Ben Souther:
I'm not sure what you're asking but did notice a bug in your code:



There is no close quote to your src attribute.


it is right in the code

this is the code of the imageGenerator
Andrea De Gaetano
Greenhorn

Joined: Mar 26, 2008
Posts: 11
I found....
there was a stupid bug in the Master servlet..
Thanks a lot to everyone who contribute to help me.
I'm a newbie in servlet tecnology but I will try to contribute to the community.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create Images from one servlet