struts2 annotation there is no action mapped for namespace / and action name

52 Views Asked by At

You may find this as duplicate but I'm not getting what is wrong with my code, so please help me out

I'm switching from using struts.xml to struts 2 convention-plugin and having problem with mapping action

there is no action mapped for namespace [/] and action name [login] associated with context path [/eCensus] 

Project Strucure

enter image description here

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>eCensus</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    <init-param>
        <param-name>struts.devMode</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>actionPackages</param-name>
        <param-value>com.shantaram.ecensus.actions</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>

LoginAction class

package com.shantaram.ecensus.actions;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class LoginAction extends ActionSupport implements Preparable {

    private static final long serialVersionUID = 1L;

    @Override
    public void prepare() throws Exception {
        // TODO Auto-generated method stub
        System.out.println("prepare Login Action");
    }

    @Override
    public String execute() throws Exception {
        // TODO Auto-generated method stub
        return super.execute();
    }

}

Jars I'm using

enter image description here

0

There are 0 best solutions below