How to centre jsp in browsers.

I 've read about all the post on the forum on this topic, however, none of the proposed solutions did the trick for me.

When I click in the background of my jsp, the properties view shows that my page has a grid layout, so I put all my components on this layout, and thought that when I centred this component my jsp would centre in the browser. No way.

I went through the page, html, head, body and form elements, but I couldn't find a clue of how to set some properties which would centre my jsp, no matter what browser or resolution a visitor is using.

Could anyone please help me out on this one, like I said I've read all the posts on this subject as well as the blog entries.

Kind regards,

Annet.

[742 byte] By [JagX] at [2007-11-26 11:30:57]
# 1
Hi!As a workaround You can use '%' instead of 'px' when You set position of your components. You can set measure in 'style' property of component.Thanks,Roman.
Grif at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...
# 2
Have you read: http://blog.sun.com/tor/entry/centering_components?It works ok in my case. What is in your jsp anyway?
discusfish at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...
# 3

Hi,

to correctly centre your page you have to:

use a grid/layout/group panel like a container where to insert all your elements(instead of putting them directly into the page).

Then, in the property panel if your container :

--> style --> position : set

left =50%(orizontal alignment)

top=50%(if you need to align verticallt)

then open margin and set:

left= -x(where x is half the width of your container)

top=-y

that's it!

gio_mori at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...
# 4
Many thanks for your replies, a combination of the content of your replies did the trick. Now I'm left with the problem of resizing the browser window, when I display something in detail-view.Kind regards,Annet.
JagX at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...
# 5
Resizing the window can be done with javascript.
Tosa_Developer at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...
# 6

That what I found out but as I wrote in another thread the following problem arose:

My master jsp contains a table with two collumns, one of which contains a companyname hyperlink. When the user clicks the hyperlink, the event handler gets the companyId and stores it insession scope and opens a jsp which contains static textfields to diplay detailed information on the company. To diplay this detail page in a separate window I added the following code between the <ui:head> and its closing tag.

<script type=攖ext/javascript?gt;

window.onload = resizeWindow()

function resizeWindow() {

window.resize(576, 432)

window.moveTo((.5 * screen.width) ?288), (.5 * screen.height) ?216)

}

This bit of code does the trick, however, when I close the newly opened window, and click a navigation tab, lets say to navigate to the home page, the master page closes, and only the detail page is diplayed. Anyone any idea what causes this behaviour?

Kind regards,

Annet.

JagX at 2007-7-7 3:46:40 > top of Java-index,Development Tools,Java Tools...