I do this sort of thing a lot. I'm not sure if the approach you're taking in your xwork file is the right way but it could be. I do know that I've had success with the following:
 
    <action name="foo" class="test.FooAction">
      <!-- results -->
      <result name="input" type="redirect">
        <param name="location">/test.jsp?objId=${objId}</param>
        <param name="parse">true</param>
      </result>
      <interceptor-ref name="workflowStack"/>
    </action>

I'm using the "parse" property to make sure that the ${} value is parsed out. Also, I'm using the "redirect" result type (dispatcher is just the normal jsp dispatcher, and it sounds like you wanted the redirect). As I said, I'm not sure if specifying the parameter separately for "objId" as part of the result will work, because I'm not sure if it will get parsed. I'm pretty sure that the static params interceptor is what allows you to separately specify the parameter as you've done, so maybe that has some parsing ability.
 
That said, the error looks like xwork is trying to set the "objId" property directly on your result. From what I understand about the static params interceptor (which is what's supposed to handle xwork-declared params you want set on your action), this objId param should be a child of the "action" xwork element, not a child of  the "result" element. The more I think about it, the less I'm convinced that it will get parsed out there, so my suggestion might be the only way to do it (I'd be curious if anyone else has ideas about that).
 
Thanks,
 
Drew


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Woon
Sent: Friday, January 16, 2004 5:06 AM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] How to redirect to a page with parameters?

Jason Carreira wrote:

Which WebWork version are you using? If it's WW2, you can use a
RedirectResult, and the location can be dynamic using the ${varName}
notation. You can also set other parameters using the <param> elements
which can have dynamic values.


Jason,

Could you give a more complete example of this?  I'm getting the following exception, and I'm not sure if I'm misinterpreting what you're saying or if there's a problem somewhere:

04:54:46,351  WARN OgnlUtil:193 - Caught OgnlException while setting property 'objId' on type 'com.o
pensymphony.webwork.dispatcher.ServletDispatcherResult'.
ognl.NoSuchPropertyException: objId
        at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:133)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1460)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
        at ognl.SimpleNode.setValue(SimpleNode.java:215)
        at ognl.Ognl.setValue(Ognl.java:478)
        at com.opensymphony.xwork.util.OgnlUtil.internalSetProperty(OgnlUtil.java:183)
        at com.opensymphony.xwork.util.OgnlUtil.setProperties(OgnlUtil.java:72)
        at com.opensymphony.xwork.util.OgnlUtil.setProperties(OgnlUtil.java:46)
        at com.opensymphony.xwork.DefaultActionInvocation.createResult(DefaultActionInvocation.java:156)
        at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:271)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:192)
        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170)
        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170)
        at org.pharmgen.webapp.UserAwareInterceptor.intercept(UserAwareInterceptor.java:58)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170)
        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170)
        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170)


In xwork.xml I have the following:

    <action name="foo" class="test.FooAction">
      <!-- results -->
      <result name="input" type="dispatcher">
        <param name="location">/test.jsp</param>
        <param name="objId">${objId}</param>
      </result>
      <interceptor-ref name="workflowStack"/>
    </action>

I have a corresponding get/setObjId() in FooAction.


Thanks,
-Mark

Reply via email to