struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject [S2] Trouble getting started
Date Sat, 26 Sep 2015 21:30:51 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

I'm working on a fresh project and using Struts 2 for the first time.
I've been using Struts 1 for more than 10 years and I generally know
my way around web applications.

I just can't seem to get a fairly simple setup working. I'm intending
to use XML-based configuration and not annotation-based configuration.

Here's what I've got:

* Struts 2.3.24.1
* Tomcat 8.0.24
* A simple web app

My web.xml looks like this:
  <filter>
    <description>
      Struts 2 action filter.
    </description>
    <filter-name>struts2</filter-name>

<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndEx
ecuteFilter</filter-class>
    <init-param>
      <param-name>actionPackages</param-name>
      <param-value>my.package.business</param-value>
<!-- do I need this if I'm going to use XML-based config? -->
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

My struts.xml looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

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

  <package name="default" namespace="/" extends="struts-default">
    <action name="list" class="my.package.business.ListAction">
      <result>/WEB-INF/list.jsp</result>
    </action>
  </package>
</struts>

I have a class, my.package.business.ListAction which has a

  public String execute()

method. I return "success" from this method (unless an exception is
thrown). During startup, I can see that Struts/XWork is being initialize
d:

26-Sep-2015 17:19:32.613 FINE [localhost-startStop-1]
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.debug
Loaded
list in 'default' package:{ActionConfig //list
(my.package.business.ListAction) - action -
file:/path/to/deploy/webapps/ROOT/WEB-INF/classes/struts.xml:
9:68}

When I try to access http://localhost:8080/list.action, I get a 404
response with nothing in the logs (except the access log: request to
/list.action resulted in a 404).

I'm sure I'm missing something super simple, here. Can anyone offer a
suggestion?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWBw6LAAoJEBzwKT+lPKRYKAoP/jgtaBdgRYCAKvXlEagne5OM
RHF+M5jqdzfmpCnEe1071DEAD7Q4wcVtKvkjaYKIczvnfx0ppPShhyE8514Ez+yB
L7nDw+YunCeZzhAk5KlaDb1piL27r1VrYQ30W9FQTrG2FQc56XW9CEAYz1rOJbZA
YlzCDWiQPgac/68NLVn2YAO5d+Mf6FBHk20EnMMxp5disRpBSsIiPvpxZQmS0c/k
eXAJMNFhHeVoUcTWHJGGnM1efV8dKvOXrLgHRPTf3Nts+cIpwRVD2iu70AwjGhdI
PeNYPb3QMfPJz0PjTTeK418mOa1CMAdUm1O9NqG2dYxdL+/5tlyCC1GsooHtroTp
gTn8mrQH9FWw87sgw4IL6nEP5x5zFEZJq1NOMOvSQY12in08AAdVFO1XJeAZzhS/
c1IVrW+zGYGWSra6njGS3uZUDiYOhomSsAkjjNz5G3yjerz6MSCr/rg8cHGnXBdN
e5eiZhmjfMTewhEsH5IuZKGmtJWPaTwMl9lYtrOMpPX5c4ela0tMluhRocttDKgk
jlegJsJeaetfMNY66g6kfKCB4DHLeQrghjPWh7Ue5gL611bXYSPZAG58jYzPF+cq
cR43Qluc1ukaOq/VdnqpYAMQ3pL1kUQDIuYVPOLN6C1YpEFb4o7WiFJbgzoQzJEl
cQi/KlhVmXmRCFA1qkXH
=SyBg
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message