Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Create Images from one servlet

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
make 3 different request.
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic