Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

@Result annotation not working

Dan C.

2008-10-14


Author LoginPost Reply

Hi, I have an app built on struts 2.0.11.2, Tiles 2.0.6 and spring 2.5.5.
Everything is currently configured with xml. I wanted to start moving as
much as I could to zero configuration. The result annotations do not seem to
get recognized. I did a simple change to 1 class to see if it works and here
is what I did

1. modified my web xml to add actionPackages to my filter
<filter>
 <filter-name>struts2</filter-name>
 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
 <init-param>
  <param-name>actionPackages</param-name>
  <param-value>com.copyright.pubcentral.web</param-value>
</init-param>

2. removed my current result from my action. So now my action looks like
this. This action is configured in my pubcentral-default-config package.

<action name="home" class="unAuthHome">
   </action>

NOTE: unAuthHome points to a spring bean action class
<bean
    parent="pubPortalActionSupport"
    name="unAuthHome"  
    class="com.copyright.pubcentral.web.actions.UnAuthHomePage"
    singleton="false">
  </bean>

3. added the result annotaion to my action class.
package com.copyright.pubcentral.web.actions;

import org.apache.struts2.config.Result;
import org.apache.struts2.views.tiles.TilesResult;

import com.copyright.pubcentral.business.data.UserType;
import com.copyright.pubcentral.config.DeploymentExposure;
import com.copyright.pubcentral.web.PubPortalUnprotectedAction;

@Result(name="view",value="tile.home",type=TilesResult.class)
public class UnAuthHomePage extends PubPortalUnprotectedAction {


  public String execute() throws Exception {

    if (getUserContext().isAuthenticated()){
   
if(_applicationUtilities.getAppConfig().getDeploymentExposure().equals(DeploymentExposure.INTERNAL)
&&
             
UserType.CCC_INTERNAL.contains(getUserContext().getActiveAppUser().getUserType()))
       return "adminHome";
     else
       return "homeAuth";
    }
    return "view";
  }
}

Now this all works in xml, but for some reason Im getting an error
o result defined for action
com.copyright.pubcentral.web.actions.UnAuthHomePage and result view - action
-
file:/C:/cvsCheckout/apps/publisher-central/src/webroot/WEB-INF/classes/pubcentral-default-config.xml:59:42
No result defined for action
com.copyright.pubcentral.web.actions.UnAuthHomePage and result view - action
-
file:/C:/cvsCheckout/apps/publisher-central/src/webroot/WEB-INF/classes/pubcentral-default-config.xml:59:42
at

I can't figure out why this doesn't work.. BTW: I had this working once, but
when I shutdown the app server and changed another class(I wanted to do this
a class at a time to make sure it was working ok). When I started the app
server again, none of them worked. I backed everything out and started again
and I can't get it to work at all..

appreciate any help.
Thanks
Dan


--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.