On Thu, 2009-01-08 at 20:23 -0800, Daniel Woo wrote:
> Hi guys,
> 
> I have a default mapping, eg,
> 
> Code:
>     <action name="*" >
>       <result>/_{1}.jsp</result>
>     </action>
>     <action name="HelloWorld" class="test.action.HelloWorld" >
>       <result name="success">/HelloWorld.jsp</result>
>     </action>
> 

I'm surprised this works, order is significant, so the wildcard would
match and look for _HelloWorld.jsp... But, since you indicate that it
does, I'm guessing in your struts.xml, you have the right order.


> 
> 
> In this case, if an action can not be matched it will be forwarded to
> /_{action name}.jsp, eg, /X.action will be forwarded to _X.jsp
> 
> It works great, however if I remove XML configurations of the action
> HelloWorld, and use annotation with test.action.HelloWorld in code, then my
> request to /HelloWorld.action goes to /_HelloWorld.jsp instead of class
> test.action.HelloWorld.
> 
> So how can I use the default mapping with annotation, and fall to default
> mapping only when no match in BOTH ANNOTATION AND XML configuration?


How are you doing the annotation configuration, meaning, which plugin?
Are you using Codebehind, Conventions, Zero-Config, etc. Most of the
plugins perform mappings by using a rewritten UnknownHandler, which
means that XML configuration takes precedence. You may be in a bit of a
pickle, since you want a default catch-all... I would suggest looking at
the Conventions plugin since it will do what you are looking for,
without the XML configuration. It will provide a default mapping by
backing each action request with ActionSupport if a JSP file exists on
the file system matching the URI of the incoming request.

-Wes


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to