I'm interested in using JSP to get the screen dimensions (not the window
dimensions) in order to size a graphic on my page. If the screen size is
greater than 800x600, I want the graphic to be larger. Here's the script I
was trying to use, but I keep getting errors that I can't make static
reference to method blah... I tried using the DisplayMode.getWidth() method,
but that requires me to create an object of type DisplayMode from which I
can then get its width. But I'm interested in getting the width of the
current user's screen, not one I might create in my program. I've also tried
the Window.getWidth() with similar results.
Can I do this in JSP?
code:
String spacer = null;
DisplayMode displayMode = new DisplayMode(800,600,24,72); //I don't want to
create this
if (displayMode.getWidth() > 800) {
spacer = ("<img src=images/0.gif width=120>");
} else {
spacer = ("<img src=images/0.gif width=40>");
}
Thanks for any help,
Chris
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com