What does %{ } mean?
I'm new t开发者_如何学编程o some Java technologies; I'm trying to use a combination of struts, hibernate, and jQuery. I'm trying to figure out what does the %{}
means in the following line of code:
<s:set name="tableModel" value="%{tableModel}" />
At CodeRanch this questions was asked. According to Sonny Gill there:
%{} syntax is used to force OGNL evaluation where Struts would otherwise be treating the value as a String literal.
Other Resources: Apache Struts OGNL Documentation
%{expression} is a OGNL escape sequence, that signals to the framework when to process the expression as an expression rather than interpreting it as a string literal.
%{tableModel}
pulls the corresponding value from the OGNL ValueStack
, which "normally" results in calling a getTableModel()
function of your current action (depending on what's on the ValueStack
).
精彩评论