如果我删除struts2 .action扩展名,为什么welcome-file-list不起作用?
如果我删除Struts2应用程序中的.action
扩展名,我会遇到问题。 我把它放在我的struts.xml
:
除索引页面外,应用程序正常工作。 我在我的web.xml
这个:
index.jsp
当我访问http://localhost/myApp/
,我收到以下错误:
There is no Action mapped for namespace [/] and action name [index.jsp] associated with context path [/myApp]. - [unknown location]
但是,如果我访问http://localhost/myApp/fooAction
,我没有收到任何错误并且工作正常。
如果我更改非空扩展的扩展名(如"html"
),如果我访问http://localhost/myApp/
,我会完全看到索引页面。
那么,我正在做的事情有什么不对吗? 删除扩展程序时,为什么会出现此错误? 有没有可行的方法没有得到它?
编辑:如果我在放置一个动作,则错误如下:
There is no Action mapped for namespace [/] and action name [] associated with context path [/myApp].
我在其中一个应用程序中遇到同样的问题,我需要在页面加载时调用Action来代替
的index.jsp
或welcom.jsp
。我做了以下步骤
在我的web.xml中放置以下条目。
index
我在web-app文件夹中创建了一个带有名称index
的空文件,最后将以下条目放在我的struts.xml文件中
/ab.jsp
所以在这种情况下,当我点击这个URL www.myapp.com/myApp
,它的Struts2和我的调用索引操作能够为我的欢迎页面完成所有初始化工作。
我有同样的问题,但解决了!!!!
如果你使用
在struts.xml中
然后把欢迎档案作为
index.jsp
在web.xml中
并在struts.xml中给出如下操作
WEB-INF/login.jsp