wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to set size of servlet generated image to match size of browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to set size of servlet generated image to match size of browser window" Watch "How to set size of servlet generated image to match size of browser window" New topic
Author

How to set size of servlet generated image to match size of browser window

Barron Greig
Greenhorn

Joined: Jan 26, 2002
Posts: 8
Hello all,
I have a servlet that generates JPEG with hardcoded dimensions. What I'd really like though is to somehow pass details of the browser window width and height to the servlet so that it generates an image exactly that size. Also, if the user resized the window, then I'd send back a new image with the correct dimensions.
Any ideas how I'd do this?
Thanks in advance,
Barry
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I think you would have to use JavaScript to get the screen height and width and incorporate that information in the URL for the image. Looking at this JavaScript Pocket Reference I just got, that looks like screen.availHeight and screen.availWidth (but it has been some time since I wrote any Javascript)
Bill
 
Consider Paul's rocket mass heater.
 
subject: How to set size of servlet generated image to match size of browser window
 
Similar Threads
putting images in java applet using swing, which is coded in netbeans IDE.
Display IMG from Blob database field ?
Resize JFrame to fit image
Generating PDF and displaying it ...
can HTML page be displayed using servlet in app-serv communication