struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morten Solberg <>
Subject Struts2 Sitemesh handling 404
Date Tue, 04 Aug 2009 08:19:36 GMT

I am having a hard time figuring out how to get this working properly. I 
have handled 404 pages / unknown actions this way:


<package name="error" namespace="/error" extends="controlpanel-default">
   <action name="pagenotfound" class="com.uniweb.cp.common.Error">
    <result name="success" type="freemarker">/error/notfound.ftl</result>

This works fine and are not decorated. This is what I want. For unknown 
actions e.g URL's like http://localhost:8080/asdf, I have implemented 
UnknownHandler with the definition of handleUnknownAction like this:

public ActionConfig handleUnknownAction(String namespace, String actionName)
             throws XWorkException {
ActionConfig actionConfig = new ActionConfig.Builder("error", 
"pagenotfound", "com.uniweb.cp.common.Error")
				.addResultConfig(new ResultConfig.Builder(Action.SUCCESS, 
  return actionConfig;

This redirects to the same action, however, notfound.ftl in this case is 

Have any of you had the same problem? Or is there another way to solve 
the unknown action problem?


Morten Solberg

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message