jsf:commandButton width?

what is it with commandButtons... no width attribute? am I just missing something?

In my web app I would like a few buttons which look much, much better if they are of consitant sizes.

ie:

| | | |

instead of :

| | | ||||

you get the picture...

is this possible? should I be using a different component?

thanks for any assistance!!

/caj

[397 byte] By [caja] at [2007-10-2 20:26:57]
# 1
You should probably be looking at applying a style class to the command button.CowKing
IamCowKinga at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
That does not help the situation, as the commandButton does not have a width attribute that can be applied (directly, or via CSS). CSS is simply a method of applying a consistent style to components, it does not contain extra attributes./caj
caja at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
If you use tomahawk commandButton you have a size property.www.myfaces.org
pringia at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I have a command Button that uses CSS to set its width.

<h:commandButton id="submit" styleClass="button" action="#{ProductBean.addProduct}" value="#{Message.add_button}" />

Note the tag styleClass --> "button" this is my custom style.

In your css add the following:

input.button

{

width: 100px;

text-align:center;

color: white;

background:lime;

}

and you will have a lime button with white text that is 100px wide.

necromancerema at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

thanks for everyones comments...

I originally had a style applied, with the width element - which did not work... hence my posting to the forum, however today, after restarting both my machine and my ide (JDeveoper) it seems to work fine (no code change).

Last week when I added the new style to my CSS, i could not assign the style to my commandButton automatically (using the style class property - a drop down appears with the available styles - i assumed that this was because of the invalid width element) - it would seem that JDdeveloper has some issues refreshing, and restarting made it re-register the style classes.

anyway, problem solved :o)

thanks again.

caja at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
The good old JDeveloper. I have the same issues that you have with style sheets. The best thing to do is to close Jdeveloper, Open it, Refresh, clean, close, open again, rebuild and run. Even so somethimes doesn't work.... ;-)
pringia at 2007-7-13 23:09:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...