Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

RE: Can actions have paths?

Neil Aggarwal

2007-02-26

Replies:

Dave:

I tried setting the SlashesInActionNames and then
I added a LoginInterceptor to make sure the user
is logged in.

Now, when I try to load this url
https://tweb.retcgroup.com/thymeleweb/marketing/CreateMarketingList.action

I get this error:

There is no Action mapped for action name marketing/top/Login. - [unknown
location]
 
com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java:1
86)
 
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsAct
ionProxyFactory.java:41)
 
org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:497)
 
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:421)

It is getting marketing/top/Login instead of /top/Login even though I
specified
in the struts.xml to to go /top/Login:

<!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.enable.SlashesInActionNames" value="true"/>

 <!-- Configuration for the top package. -->
 <package name="top" extends="struts-default">
 <interceptors>
    <interceptor name="loginInterceptor"
class="util.LoginInterceptor"/>
  <interceptor-stack name="baseStack">
   <interceptor-ref name="loginInterceptor"/>
   <interceptor-ref name="defaultStack"/>
    </interceptor-stack>
   </interceptors>

 <default-interceptor-ref name="baseStack"/>
   
 <action name="*/*" class="{1}.{2}">
    <result name="input">/{1}/{2}.jsp</result>
    <result name="login">/top/Login.jsp</result>
    <result name="success">/{1}/{2}.jsp</result>
   </action>
 </package>
</struts>

Right now, the login interceptor always
returns "login" to force the user to login:

package util;

import com.opensymphony.xwork2.*;

public class LoginInterceptor extends AbstractInterceptor {
public String intercept(ActionInvocation invocation) throws Exception {
  return "login";
}
}

Any ideas on this?

Thanks,
 Neil

--
Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Monday, February 26, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Can actions have paths?

You can also set:

struts.enable.SlashesInActionNames='true'

via property or XML config file (I'm still not
entirely sold on namespaces if you do a lot of links
between them).

d.




____________________________________________________________________________
________
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
http://mobile.yahoo.com/services?promote=mail

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


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

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