Re: Referring to Properties object via OGNL?

2008-07-14 Thread Dave Belfer-Shevett
On Monday 14 July 2008 00:30:19 Jeromy Evans wrote:
 Dave Belfer-Shevett wrote:
  In my JSP, I have:
  Preferred cid is s:property value=#attr.properties[preferredcid]/br

 This expression reads evaluate perferredcid, then get the value of
 #attr.properties[evalresult].

 I expect you want. s:property value=#attr.properties['preferredcid']/

 so it uses the literal string 'preferredcid' instead of evaluating it.

 Please let me know if that fixes it.  OGNL doesn't provide much useful
 feedback for cases like these.

That fixed it.  Is there a chance we can update the 'collections' page in the 
struts docs to give information like this?  

Thanks again.

-d

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



Re: Referring to Properties object via OGNL?

2008-07-14 Thread Jeromy Evans

Dave Belfer-Shevett wrote:



That fixed it.  Is there a chance we can update the 'collections' page in the 
struts docs to give information like this?  

  
Great!  Can you please post a comment to the relevant docs page so one 
of the developers remembers to update it?


You're also welcome to contribute to the documentation: 
http://struts.apache.org/helping.html#documentation



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



Referring to Properties object via OGNL?

2008-07-13 Thread Dave Belfer-Shevett
I have a situateion where I'm loading application specific settings via a 
Properties object on initialization.  I'm storing the Properties object up 
into the ApplicationMap (heck it could be in the SessionMap, I'm easy), 
but i can't seem to switch JSP behaviour based on information in the 
Properties map.


I'm wondering if this is because Properties isn't exactly a HashMap, so 
the #attr.mapname.somekey isn't working.


If I have a Properties object called 'props' in the SessionMap (or 
anywhere on the stack actually), I should be able to get to it via #attr - 
what's the proper syntax?


Java-wise, it's

Property p = new Properties;
String value = p.getProperty(somekey)

but naturally I don't want to do this in a scriptlet.

Help?

--
---..---.
Dave Belfer-Shevett \ KB1FWR \ JID: [EMAIL PROTECTED] \
blog:planet-geek.com '---.
[EMAIL PROTECTED]/ Things you'll hear if you have a Klingon on  \
---   your development team: 3) This code is a|
   |   piece of crap! You have no honor!   |
\__/


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



Re: Referring to Properties object via OGNL?

2008-07-13 Thread Gabriel Belingueres
Properties implements the Map interface, so AFAIK, it should work
accessing it as a Map.

Did you tried #attr.mapname[somekey]?

2008/7/13 Dave Belfer-Shevett [EMAIL PROTECTED]:
 I have a situateion where I'm loading application specific settings via a
 Properties object on initialization.  I'm storing the Properties object up
 into the ApplicationMap (heck it could be in the SessionMap, I'm easy), but
 i can't seem to switch JSP behaviour based on information in the Properties
 map.

 I'm wondering if this is because Properties isn't exactly a HashMap, so the
 #attr.mapname.somekey isn't working.

 If I have a Properties object called 'props' in the SessionMap (or anywhere
 on the stack actually), I should be able to get to it via #attr - what's the
 proper syntax?

 Java-wise, it's

 Property p = new Properties;
 String value = p.getProperty(somekey)

 but naturally I don't want to do this in a scriptlet.

 Help?

 --
 ---..---.
 Dave Belfer-Shevett \ KB1FWR \ JID: [EMAIL PROTECTED] \
 blog:planet-geek.com '---.
 [EMAIL PROTECTED]/ Things you'll hear if you have a Klingon on  \
 ---   your development team: 3) This code is a|
   |   piece of crap! You have no honor!   |
\__/


 -
 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]



RE: Referring to Properties object via OGNL?

2008-07-13 Thread Dave Belfer-Shevett

On Sun, 13 Jul 2008, Martin Gainty wrote:

access it with
%
ValueStack stack = getStack();
stack.findValue(#attr.someKey);
%
http://www.docjar.com/docs/api/java/util/Stack.html

where you put the value.. HashSet,HashMap or Property is up to you..


Doesn't this violate the 'scriptlets are bad' concept?

-dbs

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



Re: Referring to Properties object via OGNL?

2008-07-13 Thread Dave Belfer-Shevett

On Sun, 13 Jul 2008, Gabriel Belingueres wrote:

Properties implements the Map interface, so AFAIK, it should work
accessing it as a Map.

Did you tried #attr.mapname[somekey]?


Yes...

I have an interceptor that does:

applicationMap = invocation.getInvocationContext().getApplication();
applicationMap.put(properties,props);
logger.debug(Props loaded:  + props.toString());

(when run, this sez:
2008-07-12 23:18:37,828 DEBUG 
com.stonekeep.congo.interceptors.DBInterceptor:138 - Props loaded: 
{preferredcid=2008}


In my JSP, I have:
Preferred cid is s:property value=#attr.properties[preferredcid]/br

Which, when rendered:
Pddreferred cid is

(with nothing after it)

The entire interceptor that is loading up the properties file and 
publishing it into the ApplicationMap is here:


http://pastebin.stonekeep.com/4949

I may be missing something painfully obvious, but... help?

-d

--
---..---.
Dave Belfer-Shevett \ KB1FWR \ JID: [EMAIL PROTECTED] \
blog:planet-geek.com '---.
[EMAIL PROTECTED]/   Windows98 Err#021 - Error Parsing Error\
---List; Please Wait For Next Error|
\__/

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



Re: Referring to Properties object via OGNL?

2008-07-13 Thread Jeromy Evans

Dave Belfer-Shevett wrote:



In my JSP, I have:
Preferred cid is s:property value=#attr.properties[preferredcid]/br

Which, when rendered:
Pddreferred cid is

(with nothing after it)


This expression reads evaluate perferredcid, then get the value of 
#attr.properties[evalresult].


I expect you want. s:property value=#attr.properties['preferredcid']/

so it uses the literal string 'preferredcid' instead of evaluating it.

Please let me know if that fixes it.  OGNL doesn't provide much useful 
feedback for cases like these.







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