Hi all,

I have a web app made using Struts 2 version 2.1.8, and its Convention and REST 
plugins. I needed to update it to the latest version (2.3.24) but one feature I 
used to have stopped working. I tracked the versions after 2.1.8, and found out 
that it was after version 2.3.7 that the problem started to happen. I have 
created a simple app called “upgradetest" to isolate the problem. Here is the 
error scenario:

I have an Action called HomeController, in which I have a method index() that 
is marked with the @Action(“/“) annotation, so that the root url of the app 
maps to this method, like below:

package upgradetest.web.struts;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.rest.RestActionSupport;
import upgradetest.model.Messages;

public class HomeController extends RestActionSupport {

    private Messages messages;

    public HomeController() {

    public String index() {
        messages = new Messages();
        return show();

    public String show() {
        return "show";

    public Messages getMessages() {
        return messages;

Here is my struts.xml file:

<?xml version="1.0" encoding="UTF-8"?>
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

        <constant name="struts.devMode" value="true" />

        <package name="upgradetest" extends="struts-default">


        <constant name="struts.objectFactory" value="spring" />
        <constant name="struts.custom.i18n.resources" value="global-resources" 

        <constant name="struts.mapper.class" value="rest" />

        <constant name="struts.convention.action.suffix" value="Controller"/>
        <constant name="struts.convention.action.mapAllMatches" value="true"/>
        <constant name="struts.convention.default.parent.package" 


Normally, by visiting the root url of my app (“/“) in Struts2 2.1.8, the 
index() method was called, and it then took the user to the desired result. 
After the upgrade to 2.3.7, the web app is returning a 404 error.  I have 
investigated the source code and found out that the RestActionMapper of Struts 
Rest Plugin is returning null in the getMapping method (in the last line of 
code), something it did not in version 2.1.8. I believe this change was done 
for some reason so I was wondering:

Is there a way to map the root url (“/“) to a specific action of mine without 
having to do a redirect or something like that (because of a SEO requirement I 
have)? Also, am I doing it the wrong way?

Thanks in advance,
- Julio
Skype: jcnaragao
Mobile Phone: US 415-684-8506

"A human being should be able to change a diaper, plan an invasion, butcher a 
hog, conn a ship, design a building, write a sonnet, balance accounts, build a 
wall, set a bone, comfort the dying, take orders, give orders, cooperate, act 
alone, solve equations, analyze a new problem, pitch manure, program a 
computer, cook a tasty meal, fight efficiently, die gallantly. Specialization 
is for insects." 

— Robert A. Heinlein

Reply via email to