You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "A. Lotfi" <ma...@yahoo.com> on 2011/02/10 06:34:31 UTC

Looking for source code of : Jakarta Struts Live


Hi,
I am looking for the source code of this book :
Jakarta Struts Live

there is a link in this site but it's not working :
http://www.theserverside.com/news/1369775/Free-Book-Jakarta-Struts-Live


thanks, your help is appreciated.


________________________________
From: John Dondapati <dj...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Tue, February 8, 2011 1:57:42 PM
Subject: Re: Bug Fix: s:radio does not select the right option (any option)

FYI, Created an issue in the JIRA for this :
https://issues.apache.org/jira/browse/WW-3569
<https://issues.apache.org/jira/browse/WW-3569>

On Mon, Feb 7, 2011 at 8:47 PM, John Dondapati <dj...@gmail.com> wrote:

> Hello,
>
>  If you are breaking your head like me to see why the appropriate radio
> button is not selected, this might help you. FYI, I am using the simple
> theme.
>
> My s:radio tag  :
>                        <s:radio id="answers[%{#question.id}]"
> name="answers[%{#question.id}]"
>                                  list="options"  listKey="questionOptionId"
>  listValue="optionText" *value*="answers[%{#question.id}]"  />
>
> Note: answers is a HashMap<Integer, String>
>
> 1. Create a new theme. Read more 
>here<http://siriwardana.blogspot.com/2008/11/vertically-formatted-checkboxlist.html>
> if
> you don't know how.
> 2. Make the following changes to the radiomap.ftl (I am only showing the
> part that you need to fix and not the entire file).
> -------------------------------------------------------
> <#if parameters.name??>
> *<#--/*ADD THIS LINE*/-->*
> *        <#assign nameValue = stack.findString(parameters.name)/> *
>  name="${parameters.name?html}" nmv="${nameValue?html} <#rt/>
> </#if>
>  
>id="${parameters.id?html}${itemKeyStr?html<http://parameters.id?html%7D$%7BitemKeyStr?html>}"
>
> <#rt/>
> *<#--/*REMOVE THIS LINE*/-->*
> *<#if tag.contains(parameters.nameValue?default(''), itemKeyStr)> *
> *<#--/*ADD THIS LINE*/-->*
> *<#if tag.contains(nameValue, itemKeyStr) == true> *
>  checked="checked" <#rt/>
> </#if>
> -------------------------------------------------------
>
> *The problem *
>
> I am not an expert on freemarker but I guess the *nameValue *parameter is
> missing here (which is not in the documentation) and since it cannot find
> that parameter it defaults to empty string and hence it will never match the
> itemKeyStr unless the listKey is null or empty for that list item.
>
> *The Solution*
>  Just assign a *nameValue *variable to take the value from the value stack
> using the el expression you passed as it's parameter value. And use the
> tag.contains() method to compare it against the current list item's key
> which is stored in the itemKeyStr. That should work.
>
> If I am doing this right, how do we get this fix in the next patch? Please
> advise. Thanks!
>
> --
> Cheers,
> John
>
>


-- 
Cheers,
John