Hi Jeromy,

In short yes, I'm trying to do a nested evaluation. I screwed up the
description, but what you've described is what I'm trying to do. I tried all
the permutations you suggested plus more with still no joy. I've used the
reflection API as a backup but I'd prefer to use OGNL.

Any help from the OGNL gurus would be greatly appreciated.

Z.



> Zoran Avtarovski wrote:
>> I¹m trying to achieve something with OGNL and I¹d like to know if it¹s
>> possible and if so how to do it.
>> 
>> In my action I have an object called surveyResult with setter/getter. I also
>> have another object called questions with setter/getter.
>> 
>> The question object has a string element called questionEntity which is in
>> this case equal to ŒsurveyResult.initialvalue¹
>> 
>> What I want to be able to do is use the value from the surveyEntity to get a
>> value from the survey object.
>> 
>> I¹ve tried <s:property value="%{questionEntity}"/> which just gives me
>> ŒsurveyResult.intialvalue¹. Is there any way I can actually call
>> surveyResult.intialvalue and get the stored value in surveyResult?
>> 
>> 
>> Z.
>> 
>> 
>>   
> 
> So, I understand that:
> surveyResult.questionEntity="surveyResult.initialValue" (a String)
> and you want to perform a nested evaluation:
> 
> eg.
> interimResult = evaluate("surveyResult.questionEntity");
> finalResult = evaluate(interimResult);
> 
> The s:property tag does recognise nested expressions. My guess is this:
> 
> <s:property value="#root.%{surveyResult.questionEntity}/>
> 
> which reads: evaluate surveyResult.questionEntity, then get the property
> with that name from the value stack.
> 
> **BUT, I can't remember if #root is right, or #stack, or #context.stack
> #top or something like that; whatever it is that refers to the value
> stack directly. This may be visible for the config browser.
> 
> The map notation may be clearer
> 
> <s:property value="#root[surveyResult.questionEntity]/>
> 
> In the worst case, you can invoke a method directly to get the stack.
> 
> Hope that helps a little,
> Jeromy Evans
> 
> PS. I don't think this is a good idea as it is may be vulnerable to
> injecting OGNL expressions depending on how surveyResult.questionEntity
> is set.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to