Quantcast

How to control the display of Struts2 tags like s:textfield

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to control the display of Struts2 tags like s:textfield

Hubert Hers
Hi,

Could anyone tell me how to use CSS styles in Struts2 for controlling the
display of labels, input elements, buttons etc. (s:textfield, s:button,
...)?
I can control the display of the key attribute using cssStyle or cssClass,
but did not find a way to do the same with the tags:
    <s:textfield key="username" cssStyle="color:blue;"/>

Thanks, Hubert




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

Laurie Harper
Hubert Hers wrote:

> Hi,
>
> Could anyone tell me how to use CSS styles in Struts2 for controlling the
> display of labels, input elements, buttons etc. (s:textfield, s:button,
> ....)?
> I can control the display of the key attribute using cssStyle or cssClass,
> but did not find a way to do the same with the tags:
>     <s:textfield key="username" cssStyle="color:blue;"/>
>
> Thanks, Hubert

What exactly is the problem? cssStyle is a valid attribute for the
s:textfield tag. Are you saying the CSS you supply is not rendered?
Rendered but is having no effect? Or something else?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

TonyD
I have the same problem with a checkbox tag,
if a use the ccsStyle="color:Green" to change the label color to green,
it doesn't work at run time and the label remains with a black color!

It's a serious problem. I think Hubert Hers wrote for the same thing.

Could someone help us!

Thanks!

Laurie Harper wrote
Hubert Hers wrote:
> Hi,
>
> Could anyone tell me how to use CSS styles in Struts2 for controlling the
> display of labels, input elements, buttons etc. (s:textfield, s:button,
> ....)?
> I can control the display of the key attribute using cssStyle or cssClass,
> but did not find a way to do the same with the tags:
>     <s:textfield key="username" cssStyle="color:blue;"/>
>
> Thanks, Hubert

What exactly is the problem? cssStyle is a valid attribute for the
s:textfield tag. Are you saying the CSS you supply is not rendered?
Rendered but is having no effect? Or something else?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

Dale Newfield
TonyD wrote:
> I have the same problem with a checkbox tag,
> if a use the ccsStyle="color:Green" to change the label color to green,
> it doesn't work at run time and the label remains with a black color!

Is it generated by struts and ignored by the browser (if so, maybe
"Green" and "green" are not equivalent), or is it not getting to the
browser?  Maybe the attribute is being evaluated?  To find out if that's
the problem, try cssStyle="%{'color:green'}"

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

Leena Borle
You can try this,
  set the theme of your form to css_xhtml .
  If you have any css classe, you can just call them within form elements
like .e.g.
<s:submit   action="ABC"  cssClass="buttons" />
<s:textfield key="myText" labelposition="left" cssClass="textfield" />

Leena

On 7/9/07, Dale Newfield <[hidden email]> wrote:

>
> TonyD wrote:
> > I have the same problem with a checkbox tag,
> > if a use the ccsStyle="color:Green" to change the label color to green,
> > it doesn't work at run time and the label remains with a black color!
>
> Is it generated by struts and ignored by the browser (if so, maybe
> "Green" and "green" are not equivalent), or is it not getting to the
> browser?  Maybe the attribute is being evaluated?  To find out if that's
> the problem, try cssStyle="%{'color:green'}"
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

 style but nothing changes.
Please other suggestions! Thanks.

DNewfield wrote
TonyD wrote:
> I have the same problem with a checkbox tag,
> if a use the ccsStyle="color:Green" to change the label color to green,
> it doesn't work at run time and the label remains with a black color!

Is it generated by struts and ignored by the browser (if so, maybe
"Green" and "green" are not equivalent), or is it not getting to the
browser?  Maybe the attribute is being evaluated?  To find out if that's
the problem, try cssStyle="%{'color:green'}"

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
TonyD
In reply to this post by Dale Newfield
I tried your suggestions but still the ccsStyle doesn't change the checkbox label color.
My checkbox is created using an interator and is display into a table.
I tried changing the
 or the
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

TonyD
In reply to this post by Leena Borle
I tried but doesn't work.
However I'am using in my form a particular theme "qxhtml" for displaying fields horizontaly in a table tag.
I cann't believe it's so hard to change a label color with struts!
Thanks for your reply.

Leena Borle wrote
You can try this,
  set the theme of your form to css_xhtml .
  If you have any css classe, you can just call them within form elements
like .e.g.
<s:submit   action="ABC"  cssClass="buttons" />
<s:textfield key="myText" labelposition="left" cssClass="textfield" />

Leena

On 7/9/07, Dale Newfield <Dale@newfield.org> wrote:
>
> TonyD wrote:
> > I have the same problem with a checkbox tag,
> > if a use the ccsStyle="color:Green" to change the label color to green,
> > it doesn't work at run time and the label remains with a black color!
>
> Is it generated by struts and ignored by the browser (if so, maybe
> "Green" and "green" are not equivalent), or is it not getting to the
> browser?  Maybe the attribute is being evaluated?  To find out if that's
> the problem, try cssStyle="%{'color:green'}"
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

Dale Newfield
In reply to this post by TonyD
TonyD wrote:
> I tried your suggestions but still the ccsStyle doesn't change the checkbox
> label color.
You're right--cssStyle results in a style attribute on the checkbox, not
on the label.

> My checkbox is created using an interator and is display into a table.
> I tried changing the <td Style="color:green"> or the <tr> style but nothing
> changes.
> Please other suggestions! Thanks.

Capitalization matters.

It sounds like your problems have little to do with struts, but rather
trying to learn html.  There are plenty of free tutorials online.  I'd
suggest http://www.w3schools.com/default.asp as a starting point.  And
remember, different browsers work differently, so just because it works
somewhere doesn't mean it's "right."  The best bet to getting it to work
everywhere is to use mechanisms that have been standardized.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

 style but nothing
> changes.
> Please other suggestions! Thanks.

Capitalization matters.

It sounds like your problems have little to do with struts, but rather
trying to learn html.  There are plenty of free tutorials online.  I'd
suggest http://www.w3schools.com/default.asp as a starting point.  And
remember, different browsers work differently, so just because it works
somewhere doesn't mean it's "right."  The best bet to getting it to work
everywhere is to use mechanisms that have been standardized.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
TonyD
First of all, in my company, I'am representing all my colleagues that have problems with structs.
Our development tool is Eclipse 3.2.2 and our browser is Microsoft Internet Explorer.

If I have a form with only one structs tag:

<s:checkbox cssStyle="color:red" id="myckb" name="myckb" label="RED" value="true"/>

and if the syntax of this instruction is correct, I should see a checkbox with a red label checked.
What does HTML mean? I know how setting colors with HTML and it works.
The problem is structs.

DNewfield wrote
TonyD wrote:
> I tried your suggestions but still the ccsStyle doesn't change the checkbox
> label color.
You're right--cssStyle results in a style attribute on the checkbox, not
on the label.

> My checkbox is created using an interator and is display into a table.
> I tried changing the
 or the
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

Dale Newfield
TonyD wrote:
> First of all, in my company, I'am representing all my colleagues that have
> problems with structs.

The tool is called Struts.  No 'c'.

> If I have a form with only one structs tag:
>
> <s:checkbox cssStyle="color:red" id="myckb" name="myckb" label="RED"
> value="true"/>
>
> and if the syntax of this instruction is correct, I should see a checkbox
> with a red label checked.

Nothing in this tag is setting the color of the label.  You're setting
the text of the label to read "RED", and (hopefully) the style attribute
of the checkbox to be "color:red".

> What does HTML mean? I know how setting colors with HTML and it works.
> The problem is structs.

What html does executing this .jsp produce?  Either it produces the html
you think it generates, and IE is not displaying this in the way you
expect, or it does not produce the html you want it to, and you should
figure out why.

(hint:  In IE, try "view source" on the generated page.)

Have you tried the suggestions offered earlier?  For example, did you
try cssStyle="%{'color:red'}" ?

What theme is this using?  Do you have a theme attribute on the s:form
tag?  If not, do you have a struts.ui.theme setting anywhere?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

           
The Style doesn't effect the label text, I supposed that:
 
<LABEL style="COLOR: red" class=checkboxLabel for=myckb>RED</LABEL> 

was what I wanted to have, how could I obtain that?

Thanks in advance.

 

DNewfield wrote
TonyD wrote:
> First of all, in my company, I'am representing all my colleagues that have
> problems with structs.

The tool is called Struts.  No 'c'.

> If I have a form with only one structs tag:
>
> <s:checkbox cssStyle="color:red" id="myckb" name="myckb" label="RED"
> value="true"/>
>
> and if the syntax of this instruction is correct, I should see a checkbox
> with a red label checked.

Nothing in this tag is setting the color of the label.  You're setting
the text of the label to read "RED", and (hopefully) the style attribute
of the checkbox to be "color:red".

> What does HTML mean? I know how setting colors with HTML and it works.
> The problem is structs.

What html does executing this .jsp produce?  Either it produces the html
you think it generates, and IE is not displaying this in the way you
expect, or it does not produce the html you want it to, and you should
figure out why.

(hint:  In IE, try "view source" on the generated page.)

Have you tried the suggestions offered earlier?  For example, did you
try cssStyle="%{'color:red'}" ?

What theme is this using?  Do you have a theme attribute on the s:form
tag?  If not, do you have a struts.ui.theme setting anywhere?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
TonyD
I'am using the "qxhtml" theme in my form.

the output generated is:

       <INPUT id=myckb
                 style="COLOR: red" type=checkbox value=true name=myckb> 
       <INPUT type=hidden value=true name=__checkbox_myckb> 
       <LABEL class=checkboxLabel for=myckb>RED</LABEL> 
       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield



TonyD wrote
I'am using the "qxhtml" theme in my form.

the output generated is:

           
The Style doesn't effect the label text, I supposed that:
 
<LABEL style="COLOR: red" class=checkboxLabel for=myckb>RED</LABEL> 

was what I wanted to have, how could I obtain that?

Thanks in advance.

 

DNewfield wrote
TonyD wrote:
> First of all, in my company, I'am representing all my colleagues that have
> problems with structs.

The tool is called Struts.  No 'c'.

> If I have a form with only one structs tag:
>
> <s:checkbox cssStyle="color:red" id="myckb" name="myckb" label="RED"
> value="true"/>
>
> and if the syntax of this instruction is correct, I should see a checkbox
> with a red label checked.

Nothing in this tag is setting the color of the label.  You're setting
the text of the label to read "RED", and (hopefully) the style attribute
of the checkbox to be "color:red".

> What does HTML mean? I know how setting colors with HTML and it works.
> The problem is structs.

What html does executing this .jsp produce?  Either it produces the html
you think it generates, and IE is not displaying this in the way you
expect, or it does not produce the html you want it to, and you should
figure out why.

(hint:  In IE, try "view source" on the generated page.)

Have you tried the suggestions offered earlier?  For example, did you
try cssStyle="%{'color:red'}" ?

What theme is this using?  Do you have a theme attribute on the s:form
tag?  If not, do you have a struts.ui.theme setting anywhere?

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RobinCamus
You can write a new Tag extending TextFieldTag to implement your own attributes.
or
You can use the theme "simple" on your textfield so you can write the label directly in html
<LABEL style="color: green" ....>
<s:textfield ....>
       <INPUT id=myckb
                 style="COLOR: red" type=checkbox value=true name=myckb> 
       <INPUT type=hidden value=true name=__checkbox_myckb> 
       <LABEL class=checkboxLabel for=myckb>RED</LABEL> 
       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to control the display of Struts2 tags like s:textfield

yitzle
Consider wrapping it in a <span class="blah"> tag...

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...