Laszlo Borsos wrote:
I started using Spring 2 with Struts 2.
I can't use wildcard mappings though.
This works: <action name="login" class="loginAction">
This does not: <action name="*" class="{1}Action">
Is there any way around this?
kuvera
-----
http://javatar.hu Java EE programming
Laszlo,
It works. Let me go through it step by step -
Assuming that you have deployed your application to be called using
following URL - http://localhost:8090/firstapp/My.action (where firstapp
is the context root and WildCard is the action to be called)
1. Add the following config in struts.xml -
<action name="*" class="{1}Action">
<result>/index.html</result>
</action>
In this case, {1} will be replaced by first element in the URL after
context root, i.e by "My". Therefore the action class name would be
MyAction.
2. Create WildCard action class and add it to your classpath. A very
basic class implementation could be
public class MyAction extends ActionSupport {
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
3. Create a simple html file named index.html with whatever content you
want and place it under the context root.
4. Give it a spin. It works.
- Omkar
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]