Eleazar
Eleazar

Reputation: 21

Struts 2 GAE No action mapped for namespace [/]

I'm learning Struts 2 for a project requirement and I've met some issues.

Following this tutorial at:

http://www.mkyong.com/google-app-engine/google-app-engine-struts-2-example/

And what I've done extra:

Now, when I rebuild and loads

    http://localhost:8888

Rather then seeing the content I should have in my index.jsp, I'm getting a

    Error 404 There is no Action mapped for namespace [/] and action name [] associated with context path [].

Can someone point me to the right direction? I've seen some other similar questions in SO but their solutions do not work for this specific example of Struts 2 + GAE.

My struts.xml

    <struts>
        <package name="user" namespace="/User" extends="struts-default">
            <action name="Login">
                <result>pages/login.jsp</result>
            </action>
            <action name="Welcome" class="com.mkyong.user.action.WelcomeUserAction">
                <result name="SUCCESS">pages/welcome_user.jsp</result>
            </action>
        </package>
    </struts>

Folder structure

I cant post images so, http://i.imgur.com/KSPmaMr.png

Exact same libraries used for download

http://www[dot]mediafire[dot]com/?utliwvcmo63o8l7

Upvotes: 1

Views: 624

Answers (2)

DarkHorse
DarkHorse

Reputation: 2770

@Eleazar I followed the mykong tutorial link that you mentioned in your question. There is no use of index.html as far as I see that tutorial. <welcome-list> file is used when the is no action mentioned on application startup.

On step:8 in that tutorial they has provided the url which is http://localhost:8888/User/Login.action you need to run the test. Its got nothing to do with file in welcome list...

UPDATE:

You are getting that error because you have added struts2 filter as /*, and your action namespace is for /User. There is not action namespace for /. Adding package with name="default" with namespace="/" i.e <package name="default" extends="struts-default" namespace="/"></package> will resolve you issue. It will hit <welcome-file>

Upvotes: 1

arvin_codeHunk
arvin_codeHunk

Reputation: 2390

ok ,i got your problem,

change your struts.xml to this

  <struts>
       <package name="default" extends="struts-default" namespace="/">
            <action name="Login">
                <result>pages/login.jsp</result>
            </action>
            <action name="Welcome" class="com.mkyong.user.action.WelcomeUserAction">
                <result name="SUCCESS">pages/welcome_user.jsp</result>
            </action>
        </package>
    </struts>

I guess this will work, because filterDispatcher search for struts.xml file in root folder if you put your struts.xml file in root directory.

Upvotes: 1

Related Questions