Tuesday, October 27, 2009, 4:21:46 PM, Gülsün Sahin wrote:
> hi,
>
> thanks for replying,
>
> i use struts2 and i'm trying to make freemarker template instead of
> using jsp files. i'm also using tld file to create tags.
>
> And i have created a form template and corresponded tag. so i'm
> using the tag with parameter in jsp file (variables that tell which
> java variable will be showed in the form and my bean which contains this parameter)
>
> So....
> also answer is a class and has variable id, name, lastname etc...
> <fc:form variables="id, name" bean="answer"></fc:form> my customized tag
>
> and in freemarker template
>
> <#assign variables=parameters.variables.split(',') /> // convert to array
>
> <#assign answer=Request[bean] /> // fetching my answer bean
>
> now i will receive value of the variables which are given in jsp file in tag
>
> so if i write in this way, it works
>
> <input value='${answer.id}'/>
> <input value='${answer.name}'/>
>
> but if i use in following way, it doesnt work, errormessage is "answer.variables is not defined"
>
> <input value='${answer.variables[0]}'/>
> <input value='${answer.variables[1]}'/>
>
> i hope it was clearly
OK, I guess your problems is with programming in general.
"answer.variables[0]" means:
1. Get the value of the "answer" variable,
2. and within that value, take the value of the item called "variables"
(and there it fails, as it there is no such item inside the "answer"
variable),
3. and within that value, take the first item (you actually never
reach this step)
What you wanted is certainly "answer[variables[0]]", which means:
1. Get the value of the "answer" variable,
2. and within that value, take the value of the item whose
name is deduced as follows:
2.1: Take the value of the "variables" variable
2.3: and within that value, take the first item.
> thanks in advance
>
> <quote author="Daniel Dekany">
> You will have to express yourself more clearly... First of all, you
> didn't tell us what the error message was. Then, what's the importance
> of "<#assign variables=" etc., because you nowhere refer to that
> variable.
>
>
> Tuesday, October 27, 2009, 12:13:07 PM, falke2009 wrote:
>
>> Hi
>>
>> I have following problem,
>>
>> i want to access java variable dynamic. Example: A HashSet<Answer> will be
>> iterated and the Answer class has variable A,B,C,D . but
>>
>> I tried following script but it did not work
>> Input: variables are A, C and iteratedElements HashSet<Answer>
>>
>> <#assign variables=parameters.variables.split(',') />
>>
>> <#list Request[iterateElements] as element>
>>
>> <tr>
>> <td><input
>> value="${element.variables[0]}"/></td> //value of
>> variable A must be showed
>> <td><input
>> value='${element.variables[1]}'/></td> //variable B
>> </tr>
>> </#list>
>>
>> thanks in advance
>
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user