You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2007/02/26 20:51:37 UTC

Can actions have paths?

Hello:

I have this struts.xml:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
  <!-- Configuration for the default package. -->
  <package name="top" extends="struts-default">
    <action name="Login" class="top.Login">
      <result name="input">/top/Login.jsp</result>
    </action>
  </package>
</struts>

When I go to the url https://tweb.retcgroup.com/thymeleweb/Login.action
it loads fine.

I changed my action to be:
    <action name="top/Login" class="top.Login">
      <result name="input">/top/Login.jsp</result>
    </action>

Now, when I visit the url:
https://tweb.retcgroup.com/thymeleweb/top/Login.action

I get this error:

There is no Action mapped for action name 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)

Can actions have paths or are they completely flat?

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.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Can actions have paths?

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
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@yahoo.com] 
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can actions have paths?

Posted by Dave Newton <ne...@yahoo.com>.
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can actions have paths?

Posted by Dariusz Wojtas <dw...@gmail.com>.
try this:


<struts>
 <!-- Configuration for the default package. -->
 <package name="top" namespace="/top" extends="struts-default">
   <action name="Login" class="top.Login">
     <result name="input">/top/Login.jsp</result>
   </action>
 </package>
</struts>


with URL:
   https://tweb.retcgroup.com/thymeleweb/top/Login.action

It is 'namespace' that gives you action prefix in the URL.

Regards
Dariusz Wojtas



On 2/26/07, Neil Aggarwal <ne...@jammconsulting.com> wrote:
> Hello:
>
> I have this struts.xml:
>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>   <!-- Configuration for the default package. -->
>   <package name="top" extends="struts-default">
>     <action name="Login" class="top.Login">
>       <result name="input">/top/Login.jsp</result>
>     </action>
>   </package>
> </struts>
>
> When I go to the url https://tweb.retcgroup.com/thymeleweb/Login.action
> it loads fine.
>
> I changed my action to be:
>     <action name="top/Login" class="top.Login">
>       <result name="input">/top/Login.jsp</result>
>     </action>
>
> Now, when I visit the url:
> https://tweb.retcgroup.com/thymeleweb/top/Login.action
>
> I get this error:
>
> There is no Action mapped for action name 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)
>
> Can actions have paths or are they completely flat?
>
> Thanks,
>         Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org