I have a problem if I remove the .action
extension inside my Struts2 application. I put this in my struts.xml
:
<constant
name="struts.action.extension"
value="" />
The application works correctly except in the index page. I have in my web.xml
this:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
When I access to http://localhost/myApp/
, I get the following error:
There is no Action mapped for namespace [/] and
action name [index.jsp] associated with context path [/myApp].
- [unknown location]
However if I access to http://localhost/myApp/fooAction
, I'm not getting any errors and works perfectly.
If I change the extension for a non empty extension (like "html"
), I see the index page perfectly if I access to http://localhost/myApp/
.
So then, is there something wrong in what I'm doing? Why am I getting this error when I remove extension? Is there any posible way of not getting it?
Edit: If I put an action in the <welcome-page>
the error is the following:
There is no Action mapped for namespace [/] and action name []
associated with context path [/myApp].
<welcome-file>index</welcome-file>
– Haywoodhayyim<welcome-file>
as my action and i removed the extension like.jsp
from the list and created an empty file nameindex
– Drug<welcome-file>
before I put this here but since I read here that I can't do that directly (#39899) I didn't put here. I'm getting a different error, I will put it in the question. – Narcisindex
in your web-app than you need to define a mapping in your struts file like<action name="index" class="welcomeAction"></action>
Hope i am clear enough.One more point for putting comment please mark person name else that person will not get any notification about your comment – Drug