Hmm. This could be a few things. First start off with the Convention
configuration in struts.xml. By default your.jsp views will need to be in
/WEB-INF/content/. You can change this by changing the configuration setting
"struts.convention.result.path". If you are trying to use an action-less result
then you would just put the hello-world.jsp file in that default result root.
If you are trying to use an Action class then you need to understand the
default path settings for finding actions. By default if your package includes
struts, struts2, action or actions (i.e. xxx.actions.xxx). Once it sees that
package it considers it the "action root" and then starts looking for classes
that either end in Action or implement xwork's ActionSupport. So you need to
be sure your package path includes one of those words at your desired root.
In your case the HelloWorld class in question will implement ActionSupport and
be in package com.yourcompany.xxx.actions; (or the root). If for some reason
you can't use those default package words then you can tell Struts where to
look using the "struts.convention.package.locator" configuration setting ("i.e
com.yourcompany.web.controllers") -- notice no struts, struts2, action or
actions.
Even when you are using the Action class, you need to have the hello-world.jsp
in the proper "result.path" location. What can be confusing is that the
Convention will look for a whole bunch of different patterns for result file
names depending your action's name and what it returns. What can also be
confusing is that Convention is often combined with Rest plugin and that will
make everything behave a bit differently.
I am working on a new Struts2 tutorial showing how I normally use this plug-in.
If you'd like me to just email you the text you could give that a try. I am
not sure when I will have it posted somewhere.
-D
On Mar 21, 2010, at 7:14 AM, taltu wrote:
>
> Hi,
>
> Hope some can help because I spent too much time on this :(
>
> I make use of 2.1.0-M1 with Struts 2.18 modular.
>
> I need SEO friendly urls like (http://localhost:8080/hello-world)
>
> Following this short tutorial:
> http://struts.apache.org/2.1.8/docs/convention-plugin.html#ConventionPlugin-Helloworld
> Struts 2 - convention-plugin
>
> When pointing the browser url to this SEO frindly url:
> http://localhost:8080/hello-world.
>
> The error says "the page is not found".
>
> I don't know what to do ?
>
> -mike
> --
> View this message in context:
> http://n4.nabble.com/Struts-2-convention-plugin-tp1676689p1676689.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>