Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create Images from one servlet

 
Andrea De Gaetano
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make 3 different request.
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
make 3 different request.


mm ok . but How can I regenerate the request?
Thanks you
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By building img tags (as you have done) you are causing the browser to make the requests (one for each img tag).
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic