File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to place image on particular location on webpage? pixels? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to place image on particular location on webpage? pixels? " Watch "How to place image on particular location on webpage? pixels? " New topic
Author

How to place image on particular location on webpage? pixels?

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi,

This could be a very simple :$. Well, I have an image say, a circle in JPEG format which I want to place on a particular location on a webpage. Location will be decided on the basis of the pixels given. Suppose,



Now, above circle should be displayed on the webpage, such that, center of the circle should be on 200,300.

It is assumed that, circle is already existed in form of JPEG image. Just placing is the issue.

Looking forward for the reply.

Bye,
Viki.


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
I'm not sure what this has to do with JSP - seems more of an HTML question. Styling the page with CSS would let you do absolute positioning.


Ping & DNS - updated with new look and Ping home screen widget
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi,

I do not want to use CSS. The displayCircle(200,300) will be called from a servlet and the actual circle on the given co-ordinates will be displayed in browser.

Any help in this regard will be highly appreciated.

Bye,
Viki.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
THAT IS WHAT CSS IS FOR!

You have to use CSS to do the positioning. CSS is for the style of the page. Without that, you are not able to position anything on the page. Look into absolute positioning on any CSS reference with top and left.

Eric
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi,

That's OK! I have to use CSS. But I want to set the position (location) of Image on browser from (within) Servlet. That is, in servlet it will be decided where the Image (in fact at what cordinates in pixels) will be displayed on the browser?

I guess, I have to use "out.println("<HTML>")" where out is: "PrintWriter out = response.getWriter();" in servlet and have to form the dynamic HTML from the servlet.

My doubt: Can I use CSS from servlet in the same way as HTML is used?

For example, given the following style sheet:
BODY { font-size: 10pt }
H1 { font-size: 120% }

Can I call out.println(" <H1>A heading</H1>"); from withing the servlet?

Bye,
Viki.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Add the CSS directly to the element that you are dynamiclaly adding...

<img style="position:absolute;top:0px;left:300px;" ..../>

Eric
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi,

Thanks Eric. That's simply gr88 .

Bye,
Viki.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to place image on particular location on webpage? pixels?
 
Similar Threads
quickly increase the height of an image
Drawing Problem
Image smoothing
emitting byte stream from java to xsl
Show semi-transparent image on top of other JPEG