struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm jee <tm_...@yahoo.co.uk>
Subject Re: Value Stack Question
Date Sat, 18 Nov 2006 02:44:12 GMT
Hi Mark, 

By doing 
  valueStack.getContext();
we get the valueStack's context (a Map) whose value with "someKey" as its key is accessible
through
<@s.property value="%{#someKey}" />

There's a root in the value stack as well, 
  valueStack.getRoot();
which is like a stack, I think that's where the action resides.

rgds


Mark Menard <mark@mjm.net> wrote: Is there a means of examining the value stack. I have
a very strange
situation where OGNL in my JSP is returning a value from
com.opensymphony.xwork2.ActionContext.parameters on the stack, even though I
have a property with the name on my action class. It's almost like OGNL is
skipping over the property of my action and moving down the stack until it
find my property sitting in the "parameters" Map.

I'd like to be able to dump the stack from top to bottom, listing the names
of the object in the stack, and call toString() and getClass().getName() on
them.

I tried the following in an Interceptor using PreResultListener:

valueStackContext = context.getValueStack().getContext ();
for (Object o : valueStackContext.keySet () ) {
  if (o == null) {
    System.out.println ("o is null!!!!!!!!!!!!!!!!");
  } else {
    Object value = valueStackContext.get (o);
    System.out.println (o.toString() + ": " +
        (value == null ? "null" : value.toString () ) );
    System.out.println (o.toString() + ": " +
        (value == null ? "null" : value.getClass().getName () ) );
  }
}

But, I don't see my action on the stack. Stripping out the toString() output
I see the following:

17:35:27,773 INFO  [STDOUT] last.bean.accessed: null
17:35:27,773 INFO  [STDOUT] struts.actionMapping:
org.apache.struts2.dispatcher.mapper.ActionMapping
17:35:27,773 INFO  [STDOUT] com.opensymphony.xwork2.ActionContext.locale:
java.util.Locale
17:35:27,773 INFO  [STDOUT] session:
org.apache.struts2.dispatcher.SessionMap
17:35:27,773 INFO  [STDOUT] current.property.path: null
17:35:27,773 INFO  [STDOUT] attr: org.apache.struts2.util.AttributeMap
17:35:27,773 INFO  [STDOUT]
com.opensymphony.xwork2.ActionContext.application:
org.apache.struts2.dispatcher.ApplicationMap
17:35:27,773 INFO  [STDOUT] report.conversion.errors: java.lang.Boolean
17:35:27,773 INFO  [STDOUT]
com.opensymphony.xwork2.ActionContext.actionInvocation:
com.opensymphony.xwork2.DefaultActionInvocation
17:35:27,773 INFO  [STDOUT] last.property.accessed: null
17:35:27,774 INFO  [STDOUT] com.opensymphony.xwork2.ActionContext.session:
org.apache.struts2.dispatcher.SessionMap
17:35:27,774 INFO  [STDOUT] application:
org.apache.struts2.dispatcher.ApplicationMap
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.ActionContext.parameters: java.util.HashMap
17:35:27,774 INFO  [STDOUT] parameters: java.util.HashMap
17:35:27,774 INFO  [STDOUT] com.opensymphony.xwork2.ActionContext.name:
java.lang.String
17:35:27,774 INFO  [STDOUT] __link: [Ljava.lang.Object;
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.util.ValueStack.ValueStack:
com.opensymphony.xwork2.util.OgnlValueStack
17:35:27,774 INFO  [STDOUT] xwork.MethodAccessor.denyMethodExecution:
java.lang.Boolean
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.dispatcher.HttpServletRequest:
org.apache.struts2.dispatcher.StrutsRequestWrapper
17:35:27,774 INFO  [STDOUT] xwork.NullHandler.createNullObjects:
java.lang.Boolean
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.ActionContext.conversionErrors: java.util.HashMap
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.dispatcher.ServletContext:
org.apache.catalina.core.ApplicationContextFacade
17:35:27,774 INFO  [STDOUT]
com.opensymphony.xwork2.dispatcher.HttpServletResponse:
com.opensymphony.module.sitemesh.filter.PageResponseWrapper
17:35:27,774 INFO  [STDOUT] request:
org.apache.struts2.dispatcher.RequestMap

I don't see an instance of my action class, nor an ActionProxy. I do see the
com.opensymphony.xwork2.util.OgnlValueStack. Is that the actual stack that
is used by OGNL to display the view?

Thanks,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org



 Send instant messages to your online friends http://uk.messenger.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message