Then again you could just use: <tiles:insertDefinition name="${companyId}_compensation" /> or <tiles:insertDefinition name="${session.companyId}_compensation"/>
And ignore OGNL completely. In the first line, since you seem to have companyId in the session, and JSP EL searches through each scope to find a value, it will find the value of companyId (unless it finds a value in the page or request scopes first). The second makes sure it looks in the session attributes and forgoes the scope search. (*Chris*) On Tue, Jun 10, 2008 at 3:59 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > --- On Tue, 6/10/08, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> wrote: >> I'm not clear on the distinction between EL and OGNL. > > OGNL is an EL, it's just not JSP EL. > >> As a rule of thumb, would it be correct to say that OGNL is >> only valid within Struts tags, and I should never expect OGNL >> interpolation in any other context? > > Yes, with the caveat that OGNL is also valid inside S2 configuration files > when surrounded by ${}, the JSP EL escapes. > > (Don't ask, I don't know.) > >> I thought that OGNL allowed me to get session attributes >> via the $(#session.attributeId} syntax? > > Why? Is that somewhere in the S2 docs? If so, I'll fix it, because it's wrong. > > ${} (in the context of a JSP page) is JSP EL, evaluated by the container. "#" > is an OGNL character used to access a named value and is valid only inside > OGNL expressions... but. > > But if you're running a JSP 2.1+ (2.2? I can never remember) container and > attempt to use OGNL things will blow up, because # is a JSF/JSP 2.1+ escape, > so the container tries to evaluate the following expression. > >> I'm able to do what I want with this: >> <s:set name="companyId" value="#session.companyId" /> >> <tiles:insertDefinition name="${companyId}_compensation" /> >> >> Why does this work? > > Because the first tag is using pure OGNL properly, and the second one is > using JSP EL properly, but... > >> Am I using OGNL in the first line (#session.companyId) to set >> a JSP variable which I can then access in the 2nd line? > > The <s:set.../> creates a variable in the stack context. > > The reason the <tiles.../> works is because (a) if you already/still have a > normal JEE *scoped* variable (i.e., in session, request, etc.) it will find > it via the normal JSP EL lookup, and/or (b) S2 uses a custom request mapper > that will go to the stack context when a value isn't found in any of the > normal JEE scopes. > >> The 2nd line looks like OGNL as well to me, but maybe it's EL. > > It shouldn't look like OGNL. > > I'd strongly recommend spending some time with the S2 docs (and potentially > some JEE docs if necessary); they should be able to clear up all these issues. > > Dave > > > --------------------------------------------------------------------- > 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]