--- [EMAIL PROTECTED] wrote:
> When it comes to sharing values between Java and
> JSP, I see the following conventions used
> 
>    1. %foo
>    2. $foo
>    3. #foo
>    4. foo
> 
> Is there a one-stop grid that identifies what each
> of these symbols represent and if/when they are 
> even necessary?

I haven't seen one yet, and I'm still a bit fuzzy on
it myself. I (sorta) know the following:

- Action properties do not need escaping and may be
  accessed via their name, like:
  
  <s:property value="anActionVarExposedViaGetter"/>
  
  or
  
  <s:textarea name="anotherDifferentProperty"/>
  
- Vars defined in the JSP, like:

  <s:iterator list="fooList" id="foo">
    <s:property value="#foo.propertyOfFoo"/>
  </s:iterator>

  ...although in this case you could also just say :

  <s:property value="propertyOfFoo"/>
  
  because <s:iterator.../> puts each element
  on the top of the stack.
  
- Things that are put on the OGNL stack by the
framework
  are also available to JSTL via ${...}, the "old" JSP
EL,
  so you could say:
  
  ${anActionProperty}
  
  to save time.
  
  It has been noted that some people don't like mixing
  the ELs, but for me this is a big win for JSP
readability.
  
- %{} I *think* is just an OGNL EL escape, but I am
still
  pretty lost when it comes to understand when I
should/need
  to use %{} vs. #{}. I'm pretty sure you always need
it
  around, say, a method call.
  
- You left out @, which to be honest I haven't tried
for
  awhile, so it might have changed, but it let(s) you
access
  static vars/methods.
  
>    1. page
>    2. request
>    3. session
>    4. application
> 
> What is the interplay between stashing objects using
> Java code and subsequent retrieval from JSP?

Scoping works the same way; see below.

> Can Java code interact with OGNL?

Yes, the value stack is available to Java code.

> Are things automatically added/removed from the OG?

*Some* things are, like the current Action and maps
representing the "normal" four scopes, so you can
access, say, request-scoped vars via #request.varKey,
application-scoped vars via #application.varKey, etc.

That's all I know so far, and I still find myself
throwing various EL variations in some situations
until the moon is full and the pixies deem me worthy
to run my JSP.

Hmm, hopefully most of the stuff I just wrote is right
:/

d.



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

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

Reply via email to