You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Torsten Römer <to...@luniks.net> on 2007/05/23 00:11:25 UTC

Disable label & re-select tab

I have 2 beginners questions that I can't seem to figure out:

- How can I make tags like <s:radio> not to create any label and create
my own label (using for example the <s:label> tag)?

- What is the easiest way to re-select the selected tab of a
<s:tabbedPanel> when redisplaying the form? I have a String type
property for the current tab in my backing bean but I am unsure how to
use it.

Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Disable label & re-select tab

Posted by Torsten Römer <to...@luniks.net>.
The "selectedTab" attribute of course does the trick.

Is there also an easy way to know which tab was selected when the form
was submitted?

Torsten

Musachy Barroso schrieb:
> To select the tab, use the "selectedTab" attribute on tabbedPannel. For
> your
> label question check this FAQ:
> 
> http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
> 
> 
> musachy
> 
> On 5/22/07, Torsten Römer <to...@luniks.net> wrote:
>>
>> I have 2 beginners questions that I can't seem to figure out:
>>
>> - How can I make tags like <s:radio> not to create any label and create
>> my own label (using for example the <s:label> tag)?
>>
>> - What is the easiest way to re-select the selected tab of a
>> <s:tabbedPanel> when redisplaying the form? I have a String type
>> property for the current tab in my backing bean but I am unsure how to
>> use it.
>>
>> Torsten
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Disable label & re-select tab

Posted by Torsten Römer <to...@luniks.net>.
Thanks Jeromy,

I think I will try to create my own theme.

I am just wondering why the behaviour of (some of) the tags is
different; i.e. that <s:radio> always creates a label while <s:checkbox>
doesn't if theme="simple".

Torsten

Jeromy Evans schrieb:
> Either:
> - create your own theme for the radio button. Use simple/radiomap.ftl
> tyo create <mytheme>/radiomap.ftl to exclude the label that's always
> included (recommended); or
> - do a hack: you can use html inputs in your form directly in your JSP. 
> These are also included as parameters for your post. Struts2 doesn't
> know the difference provided the name equals what struts2 expects.
> 
> ie. put this in your JSP contained in your <s:iterator>:
> <input type="radio" name="car" id="reservation_carBMW M5"
> value="<s:property value = "my.property"/>"/>
> 
> 
> Torsten Römer wrote:
>> Thanks, Musachy, for the quick answer.
>>
>> I should have mentioned, that I already set theme="simple" but <s:radio>
>> would still create a label:
>>
>> <s:radio theme="simple" name="car" list="{'BMW M5'}"/>
>>
>> yields:
>>
>> <input type="radio" name="car" id="reservation_carBMW M5" value="BMW
>> M5"/><label for="reservation_carBMW M5">BMW M5</label>
>>
>> What I am actually trying to do is to create single radiobuttons in a
>> <s:iterator> loop. Sounds crazy I know, but I need to place the
>> radiobuttons in a specific layout so I can't use standard markup.
>>
>> All works fine, I just can't get rid of the labels :-(
>>
>> Torsten
>>
>> Musachy Barroso schrieb:
>>  
>>> To select the tab, use the "selectedTab" attribute on tabbedPannel. For
>>> your
>>> label question check this FAQ:
>>>
>>> http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
>>>
>>>
>>>
>>> musachy
>>>
>>> On 5/22/07, Torsten Römer <to...@luniks.net> wrote:
>>>    
>>>> I have 2 beginners questions that I can't seem to figure out:
>>>>
>>>> - How can I make tags like <s:radio> not to create any label and create
>>>> my own label (using for example the <s:label> tag)?
>>>>
>>>> - What is the easiest way to re-select the selected tab of a
>>>> <s:tabbedPanel> when redisplaying the form? I have a String type
>>>> property for the current tab in my backing bean but I am unsure how to
>>>> use it.
>>>>
>>>> Torsten
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>       
>>>     
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Disable label & re-select tab

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Either:
 - create your own theme for the radio button. Use simple/radiomap.ftl 
tyo create <mytheme>/radiomap.ftl to exclude the label that's always 
included (recommended); or
 - do a hack: you can use html inputs in your form directly in your 
JSP.  These are also included as parameters for your post. Struts2 
doesn't know the difference provided the name equals what struts2 expects.

ie. put this in your JSP contained in your <s:iterator>:
<input type="radio" name="car" id="reservation_carBMW M5" value="<s:property value = "my.property"/>"/>


Torsten Römer wrote:
> Thanks, Musachy, for the quick answer.
>
> I should have mentioned, that I already set theme="simple" but <s:radio>
> would still create a label:
>
> <s:radio theme="simple" name="car" list="{'BMW M5'}"/>
>
> yields:
>
> <input type="radio" name="car" id="reservation_carBMW M5" value="BMW
> M5"/><label for="reservation_carBMW M5">BMW M5</label>
>
> What I am actually trying to do is to create single radiobuttons in a
> <s:iterator> loop. Sounds crazy I know, but I need to place the
> radiobuttons in a specific layout so I can't use standard markup.
>
> All works fine, I just can't get rid of the labels :-(
>
> Torsten
>
> Musachy Barroso schrieb:
>   
>> To select the tab, use the "selectedTab" attribute on tabbedPannel. For
>> your
>> label question check this FAQ:
>>
>> http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
>>
>>
>> musachy
>>
>> On 5/22/07, Torsten Römer <to...@luniks.net> wrote:
>>     
>>> I have 2 beginners questions that I can't seem to figure out:
>>>
>>> - How can I make tags like <s:radio> not to create any label and create
>>> my own label (using for example the <s:label> tag)?
>>>
>>> - What is the easiest way to re-select the selected tab of a
>>> <s:tabbedPanel> when redisplaying the form? I have a String type
>>> property for the current tab in my backing bean but I am unsure how to
>>> use it.
>>>
>>> Torsten
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>       
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Disable label & re-select tab

Posted by Torsten Römer <to...@luniks.net>.
Thanks, Musachy, for the quick answer.

I should have mentioned, that I already set theme="simple" but <s:radio>
would still create a label:

<s:radio theme="simple" name="car" list="{'BMW M5'}"/>

yields:

<input type="radio" name="car" id="reservation_carBMW M5" value="BMW
M5"/><label for="reservation_carBMW M5">BMW M5</label>

What I am actually trying to do is to create single radiobuttons in a
<s:iterator> loop. Sounds crazy I know, but I need to place the
radiobuttons in a specific layout so I can't use standard markup.

All works fine, I just can't get rid of the labels :-(

Torsten

Musachy Barroso schrieb:
> To select the tab, use the "selectedTab" attribute on tabbedPannel. For
> your
> label question check this FAQ:
> 
> http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html
> 
> 
> musachy
> 
> On 5/22/07, Torsten Römer <to...@luniks.net> wrote:
>>
>> I have 2 beginners questions that I can't seem to figure out:
>>
>> - How can I make tags like <s:radio> not to create any label and create
>> my own label (using for example the <s:label> tag)?
>>
>> - What is the easiest way to re-select the selected tab of a
>> <s:tabbedPanel> when redisplaying the form? I have a String type
>> property for the current tab in my backing bean but I am unsure how to
>> use it.
>>
>> Torsten
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Disable label & re-select tab

Posted by Musachy Barroso <mu...@gmail.com>.
To select the tab, use the "selectedTab" attribute on tabbedPannel. For your
label question check this FAQ:

http://cwiki.apache.org/WW/why-do-the-form-tags-put-table-tags-around-controls.html

musachy

On 5/22/07, Torsten Römer <to...@luniks.net> wrote:
>
> I have 2 beginners questions that I can't seem to figure out:
>
> - How can I make tags like <s:radio> not to create any label and create
> my own label (using for example the <s:label> tag)?
>
> - What is the easiest way to re-select the selected tab of a
> <s:tabbedPanel> when redisplaying the form? I have a String type
> property for the current tab in my backing bean but I am unsure how to
> use it.
>
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd