Thanks Martin, I understand that. But what I’m trying to do is take one parameter, evaluate it and then evaluate the result.
For example: I have a question bean with an surveyEntity attribute. The value is variable and it may be 'surveyLong.initialValue'. I now want to evaluate this string as an OGNL expression ie call getSurveyLong().getInitialValue(); I've done it using reflection, but reflection has a heavy performance penalty and from what I've seen of OGNL, it doesn't. Z. > > If surveyResult is a bean > you can access initialvalue attribute with > > http://struts.apache.org/2.0.11.2/docs/tag-syntax.html > ${surveyResult.initialvalue} > > HTH > Martin > ______________________________________________ > Disclaimer and confidentiality note > Everything in this e-mail and any attachments relates to the official business > of Sender. This transmission is of a confidential nature and Sender does not > endorse distribution to any party other than intended recipient. Sender does > not necessarily endorse content contained within this transmission. > > >> Date: Wed, 6 Aug 2008 22:49:09 +1000 >> Subject: Re: OGNL Help >> From: [EMAIL PROTECTED] >> To: user@struts.apache.org; [EMAIL PROTECTED] >> >> 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 questions 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] >> > > > Get Windows Live and get whatever you need, wherever you are. Start here. > <http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home_082008> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]