You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Rank <er...@lo-fi.net> on 2008/07/17 22:15:34 UTC
Wildcard mappings and Annotations
Hi Struts Users,
Is it possible to define wildcard mappings with an annotated action?
I'm using struts 2.0.11 and I'd like to do some wildcard mapping with a
zero-config and annotations paradigm.
For example, I'd like to have a way to have http://site.com/page/variable go
to an action annotated as
@Results({
@Result(name="success", value="success.jsp"),
@Result(name="input", value="input.jsp")
})
public class PageAction extends ActionSupport {
}
As shown above, the only valid url for this action would be
http://site.com/page
I can override with an action mapping in the struts.xml as follows, but I'd
like to avoid using xml if I can.
<action name="page/*" class="com.site.actions.PageAction">
<param name="variable">{1}</param>
<result name="input">input.jsp</result>
<result name="success">success.jsp</result>
</action>
Thanks for the help.
Eric Rank