tags:

views:

164

answers:

3

I've got a simple Struts 2 application that I build and deploy to glassfish with Netbeans. When I point the web browser to http://localhost:8080/Struts2Hello/login.action/ it gives this error:

There is no Action mapped for namespace / and action name .

My action is named "login". Why does it think it is named "."?

(In order to get this far I've also had to add the javassist-3.7.ga to my lib/ directory. I'm not sure why, but that's what others have done to make Struts 2.2 work.)

Here's my web.xml and struts.xml files (yes, the struts.xml gets deployed to WEB-INF/classes):

<filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
    <filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
    <welcome-file>Login.jsp</welcome-file>
</welcome-file-list>

<package name="default" extends="struts-default" namespace="/">

    <action name="login" class="action.LoginAction">
        <result name="success">Welcome.jsp</result>
        <result name="error">Login.jsp</result>

    </action>
</package>

Thanks.

Dean

A: 

My problem was that I had the .jsp files in the WEB-INF/ dir instead of one level higher. Strange error message for that problem, though.

Dean Schulze
A: 

In struts.xml(or any other struts config files included), content of mapping is back to the original Servlet/Jsp, i.e. you CAN NOT put .jsp files under WEB-INF. e.g. if the result in struts config file is: Welcome.jsp then you should put Welcome.jsp under the package root, like Web-pages ...WEB-INF ...Welcome.jsp ...menu ......menu.xhtml

A: 

Why are you starting a new project with Strugs 1 or 2 in todays day and age when there are a million better options ? Almost anything and everything is better...

mP
It's not my call. And from what I've seen of Struts 2 it is orders of magnitude better than Struts.
Dean Schulze