Java Mailing List Archive

http://www.junlu.com/

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

Re: Can actions have paths?

Dariusz Wojtas

2007-02-26

Replies:

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 <neil@(protected):
> 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@(protected)
For additional commands, e-mail: user-help@(protected)

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