You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dan C." <dc...@gmail.com> on 2008/10/14 18:07:37 UTC
@Result annotation not working
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
--
View this message in context: http://www.nabble.com/%40Result-annotation-not-working-tp19976436p19976436.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org