Hi all,

No more news about that ?

I read all docs and faqs and I can not find anything...

 

________________________________

De : Romain Maton 
Envoyé : jeudi 16 octobre 2008 17:43
À : '[EMAIL PROTECTED]'; user@struts.apache.org
Objet : Struts2 with Annotation and <sx:a> problem (always returning the 
default action)

 

Hi all,

 

Sorry, I don't know which mailing list to contact so...

 

I will try to explain as I can my problem :

 

*       I use Struts 2, my actions are defined with Annotations.
*       I have a struts.xml very simple, only defining a default page, here it 
is :

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

    "http://struts.apache.org/dtds/struts-2.0.dtd";>

<struts>

   <constant name="struts.locale" value="fr_FR" />

   <package abstract="true" namespace="/" name="welcome" 
extends="struts-default">

       <default-action-ref name="index"/>

   </package>

</struts>

 

*       My index action :

 

@Namespace("/")

@ParentPackage("welcome")

@Results( [EMAIL PROTECTED](name = "success", value = "/myMain.jsp")})

@Validation

public class IndexAction extends ActionSupport {

// My stuff

}

 

*       In a JSP of my webapp, I use <sx:a> dojo tag to make an ajax call, here 
it is :

 

<s:url id="urlMyAction" namespace="/" action="myAction" method="execute">

   <s:param name="myId">${id}</s:param>

</s:url>

<sx:a title="a title" targets="divResult" href="%{ urlMyAction }">click 
me</sx:a>

 

*       And my action that extends a default action :

 

public class MyActionAction extends DefaultActionAction {

   @Override

   public String execute() throws Exception {

      // My stuff

      return SUCCESS;

   }

}

 

@Namespace("/")

@ParentPackage("struts-default")

@Results( [EMAIL PROTECTED](name = "success", value = "aJsp.jsp")})

@Validation

public abstract class DefaultActionAction extends ActionSupport {

// My stuff

}

 

And with that code, I have on my "divResult" that contained, after the ajax 
return, my home page <default-action-ref name="index"/> !!! 

 

2 possible "BAD" correction :

 

1.      Remove my default home page (no more package in struts.xml and 
"struts-default" in parent package of IndexAction) => OK but my URL must 
contain http://...namespace/index.action which is not acceptable.
2.      Copy-paste all Struts2 annotations from "DefaultActionAction" to 
"MyActionAction" : work too but not acceptable too.

 

I am not sure if the problem is because of annotation and package configuration 
in struts.xml in conflict (resolution 1) or a bug in annotation class 
derivation (resolution 2).

 

Does anyone know the problem ??? What is the "GOOD" solution ?

 

Thanks all,

 

Romain

 

Reply via email to