execute() method is not being called

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

execute() method is not being called

jstuardo
Hello... I am new to Struts2 and I have a problem.

I have a simple page, with an Index.jsp file at the root directory. An Index.java code in "src" folder, inside "agenda" package.

struts.xml file contains this snippet:

<struts>
    <package name="home" namespace="/" extends="struts-default">
        <default-action-ref name="home" />
       
        <action name="home" class="agenda.Index">
            <result>Index.jsp</result>
        </action>
    </package>
</struts>

The Index.java code contains:

public class Index extends ActionSupport {

    @Override
    public String execute() throws Exception {
        System.out.println("esta es una prueba");
        throw new Exception();
        //return SUCCESS;
    }
.........
}

When I run the application, the index page was shown (the jsp file) but "esta es una prueba" message did not appear. Then I added the throw sentence and the page did not show the exception. With those tests I can be sure that execute method is not getting called.

Action is recognized since I see it in configuration browser.

What is it wrong with it?

Thanks a lot in advance
Jaime