If your really want to separate your actions with slash, you should use NAMESPACE
, try this:
<package name="profile" extends="struts-default" namespace="/Profile">
<action name="*" method="{1}" class="com.controller.Profile">
<result name="view" tiles="viewProfile">viewProfile</result>
<result name="edit" tiles="editProfile">editProfile</result>
</action>
</package>
And if you are trying to use parameters on the url, you should consider use
<constant name="struts.enable.SlashesInActionNames" value="true"/>
on your Struts 2 configuration file.
Regards to the Wildcart Mapping document, you can also do this:
<action name="**" method="{1}" class="com.controller.Profile">
<result name="view" tiles="viewProfile">viewProfile</result>
<result name="edit" tiles="editProfile">editProfile</result>
</action>
** matches zero or more characters including the slash ('/') character.
You can also find this on the Wildcart Mapping document.
You should think about what you really want first, then do the configuration and implementation.
In your case, Struts 2 thinks that you have slash on your action, regards to the Action Configuration
Action Names With Slashes
If your action names have slashes in them
(for example, <action name="admin/home" class="tutorial.Admin"/>
) you
need to specifically allow slashes in your action names via a
constant in the struts.xml file by specifying
<constant> name="struts.enable.SlashesInActionNames" value="true"/>
.
See JIRA Issue WW-1383 for discussion as there are side effects to setting
this property to true.
Action Names with Dots and Dashes
Although action naming is pretty
flexible, one should pay attention when using dots (eg. create.user
)
and/or dashes (eg. my-action
). While the dot notation has no known
side effects at this time, the dash notation will cause problems with
the generated JavaScript for certain tags and themes. Use with
caution, and always try to use camelcase action names (eg.
createUser
) or underscores (eg. my_action
).
So Struts 2 will convert your slash to an underscore.