struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [S2] Trouble getting started
Date Mon, 28 Sep 2015 16:11:55 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Christoph,

On 9/28/15 6:52 AM, Christoph Nenning wrote:
>> From: Christopher Schultz <chris@christopherschultz.net> To:
>> Struts Users Mailing List <user@struts.apache.org>, Date:
>> 26.09.2015 23:31 Subject: [S2] Trouble getting started
>> 
>> -----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.StrutsPrepareAn
dEx
>>
>> 
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>
>> 
> 
> Nope, "actionPackages" is used by convention-plugin only. You don't
> need it in your case.

Thanks.

>> <filter-mapping> <filter-name>struts2</filter-name> 
>> <url-pattern>/*</url-pattern> </filter-mapping>
>> 
> 
> This could be the problem. Please try *.action here. Not sure
> anymore but I think there are issues when using different
> url-patterns.

/* ought to work, but I'll try *.action.

>> 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.deb
ug
>>
>> 
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).
>> 
> 
> Comes the 404 along with html?

No, there is no content.

> What does it look like?

Blank page. I believe Tomcat returns 404 with no document, but I
haven't looked at the protocol trace, yet.

> Is it a tomcat-error-page?

No.

> Do you have your app deployed as root app? So you don't need
> context-path in URL?

Correct.

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

iQIcBAEBCAAGBQJWCWbLAAoJEBzwKT+lPKRY0osQAK3Omvyx4+gFCc3qtQ8fuUjI
U0kR9GNww/WbcP3mGgSDxOtntGI2ddw/0mJou4tH7F5NnV69t7PjXF6I0ni9z49p
g/Zz8kjjosfPOInlU65DeH+FMcI+FHH1LS/vbS/iOr7HAMl9O8yEfMniJDQef4DE
haqM/IF/yyvj8cfd9o5eVAcHguIyLw0f+smEms8wgzxvcewyw9NoZqgUGSpK/Uk2
lbOawTsaBg4hcqS3tvwAH1Nj79BPNS+17vFlwLcijv1H0n1bltKxW3DHg6MixHsd
/uEJNlewRjB7A+9n4F13Xhy+Q7wi+Opr3Adj7/1eWY6W8wl+pSg0ff3G4/8uVvZA
3pLLEVIFbMVA1dL9nKuKKqQftiQzf665ngCrLjkd3d0QmtaXzTx8PZc3sMe4EjBy
+lwgImyPt9cM1jwnzlNaxliipopd5qtxb84p5zBWenP3Y0vlma8qEk9DH2kf0klz
Lbdj6wi8ekXNgYZcewcCBPBeJwWK1McpIYQ3ejJd+bdpxX2BDPiZGrjzxwovkan/
wA0K5aXfcvOzhdGO3ew1+EQvEWZ7sPPKj281ozg7KHfqWlCB9hJP6Wch5a8vB0QG
JEXIM2NQgYQyLTb8lAQME72N6op8MS36KwESHUHq9ZLQ5aijdXASLOvbcPGA8edX
i0nAKMO32wkjKJEIQzph
=vk6p
-----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