Jeffrey, the mailing list is
[EMAIL PROTECTED]

To answer your question, your Xwork.xml file does not define any
Interceptors for your action. You need at least the
ParameterInterceptor. This will set the parameters from your extra
context into your Action. 

Jason

> -----Original Message-----
> From: Jeffrey Gilbert [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 13, 2004 5:45 PM
> To: [EMAIL PROTECTED]
> Subject: xwork ActionContext not being passed to Action? Help?
> 
> 
> What am I doing wrong?
> 
> I'm trying to test a simple Action in xwork but I'm unable to pass my 
> actioncontext in???
> I'm following an example out of the book Java Open Source Programming.
> 
> =================================================================
> 
> package com.gilbert;
> import com.opensymphony.xwork.ActionProxyFactory;
> import com.opensymphony.xwork.ActionProxy;
> import com.opensymphony.xwork.ActionContext;
> import java.util.Map;
> import java.util.HashMap;
> 
> public class Test {
>      public static void main(String[] args) throws Exception {
>          Map params = new HashMap();
>          params.put("name", "Jeffrey");
>          Map extraContext = new HashMap();
>          extraContext.put(ActionContext.PARAMETERS, params);
> 
>          ActionProxyFactory factory = ActionProxyFactory.getFactory();
>          ActionProxy proxy = 
> factory.createActionProxy("default","hello", 
> extraContext);
>          System.out.println(proxy.execute());
>          HelloWorld hello = (HelloWorld)proxy.getAction();
>          System.out.println(hello.getGreeting());
>      }
> }
> 
> =================================================================
> 
> package com.gilbert;
> import com.opensymphony.xwork.Action;
> 
> public class HelloWorld implements Action {
>      String name;
>      String greeting;
> 
>      public void setName(String name){
>          this.name = name;
>      }
> 
>      public String getGreeting(){
>          return this.greeting;
>      }
> 
>      public String execute() throws Exception {
>          greeting = "Hello, " + this.name;
>          return SUCCESS;
>      }
> }
> 
> =================================================================
> 
> <!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" 
> "http://www.opensymphony.com/xwork/xwork-1.0.dtd";>
> 
> <xwork>
>      <package name="default">
>          <action name="hello"
>              class="com.gilbert.HelloWorld">
>          </action>
>      </package>
> </xwork>
> 
> =================================================================
> 
> Here is my actual command I'm executing: 
> =============================== C:\jdk1.3.1_07\bin\javaw.exe 
> -classpath 
> C:\jdk1.3.1_07\jre\lib\i18n.jar;C:\jdk1.3.1_07\jre\lib\jaws.ja
> r;C:\jdk1.3.1_07\jre\lib\rt.jar;C:\jdk1.3.1_07\jre\lib\sunrsas
> ign.jar;C:\jdk1.3.1_07\jre\lib\ext\jce1_2_2.jar;C:\jdk1.3.1_07
> \jre\lib\ext\jnet.jar;C:\jdk1.3.1_07\jre\lib\ext\local_policy.
> jar;C:\jdk1.3.1_07\jre\lib\ext\sunjce_provider.jar;C:\jdk1.3.1
> _07\jre\lib\ext\US_export_policy.jar;C:\javaDevelopment\xwork-
> example\lib\xwork-1.0.jar;C:\javaDevelopment\xwork-example\lib
> \commons-logging.jar;C:\javaDevelopment\xwork-example\lib\cos-
> multipart.jar;C:\javaDevelopment\xwork-example\lib\mail.jar;C:
> \javaDevelopment\xwork-example\lib\ognl-2.6.3-modified.jar;C:\
> javaDevelopment\xwork-example\lib\oscore-2.2.1.jar;C:\javaDeve
> lopment\xwork-example\lib\pell-multipart.jar;C:\javaDevelopmen
> t\xwork-example\lib\velocity-dep-1.3.1.jar;C:\javaDevelopment\
> xwork-example\lib\log4j-1.2.8.jar;C:\javaDevelopment\xwork-exa
> mple\lib\xmlParserAPIs.jar;C:\javaDevelopment\xwork-example\li
> b\xercesImpl.jar;C:\javaDevelopment\xwork-example\lib\xml-apis.ja
> r 
> ;C:\javaDevelopment\xwork-example\lib com.gilbert.Test
> 
> 0 [main] WARN xwork.DefaultActionInvocation  - No result 
> defined for action 
> com.gilbert.HelloWorld and result success
> success
> Hello, null
> 
> 
> Why Hello, null???
> 
> 
> [EMAIL PROTECTED]
> 
> 
> 


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to