Quantcast

Struts2 namespace confusion

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Struts2 namespace confusion

Matt Williams
Hello,
I have been using struts 2.1.8 for a while and last night noticed an issue with mapping actions working with any url.

For instance in the struts.xml file:
- I have a package with a namespace of "/employee".
- Within the package, I have an action mapping "search"
- The webapp name is "TestWeb".

So to access this page, I can go to: http://localhost:8080/TestWeb/employee/search.action and this works.
However, if anything is added to the URL after the namespace such as: http://localhost:8080/TestWeb/employee/someExtraText/search.action the page still loads.

Why does this happen?


Reading the struts documentation
(http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html) would make me assume that it should search the "/employee/someExtraText" namespace...not find it, so then it should fall back to the default "" namespace...not find it...then display no action mapping found.


Any insight? Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

John Patrick
Not seen this happen myself, what struts jar's do you have as it might be
something like the convention plugin...

If your using maven then it might be useful for others to include what
specific maven dependencies your including so potentially someone else can
try using the exact same jars.

John



On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:

> Hello,
> I have been using struts 2.1.8 for a while and last night noticed an issue
> with mapping actions working with any url.
>
> For instance in the struts.xml file:
> - I have a package with a namespace of "/employee".
> - Within the package, I have an action mapping "search"
> - The webapp name is "TestWeb".
>
> So to access this page, I can go to:
> http://localhost:8080/TestWeb/employee/search.action and this works.
> However, if anything is added to the URL after the namespace such as:
> http://localhost:8080/TestWeb/employee/someExtraText/search.action the
> page still loads.
>
> Why does this happen?
>
>
> Reading the struts documentation
> (http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> would make me assume that it should search the "/employee/someExtraText"
> namespace...not find it, so then it should fall back to the default ""
> namespace...not find it...then display no action mapping found.
>
>
> Any insight? Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Matt Williams
For struts 2.1.8, I am using the following jars:
- freemarker-2.3.15.jar
- ognl-2.7.3.jar
- struts2-core-2.1.8.1.jar
- struts2-json-plugin-2.1.8.1.jar
- struts2-tiles-plugin-2.1.8.1.jar
- tiles-api-2.1.3.jar
- tiles-core-2.1.3.jar
- tiles-jsp-2.1.3.jar
- tiles-servlet-2.1.3.jar
- xwork-core-2.1.6.jar


Matt





On Saturday, May 24, 2014 10:35 AM, John Patrick <[hidden email]> wrote:
Not seen this happen myself, what struts jar's do you have as it might be
something like the convention plugin...

If your using maven then it might be useful for others to include what
specific maven dependencies your including so potentially someone else can
try using the exact same jars.

John






On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:

> Hello,
> I have been using struts 2.1.8 for a while and last night noticed an issue
> with mapping actions working with any url.
>
> For instance in the struts.xml file:
> - I have a package with a namespace of "/employee".
> - Within the package, I have an action mapping "search"
> - The webapp name is "TestWeb".
>
> So to access this page, I can go to:
> http://localhost:8080/TestWeb/employee/search.action and this works.
> However, if anything is added to the URL after the namespace such as:
> http://localhost:8080/TestWeb/employee/someExtraText/search.action the
> page still loads.
>
> Why does this happen?
>
>
> Reading the struts documentation
> (http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> would make me assume that it should search the "/employee/someExtraText"
> namespace...not find it, so then it should fall back to the default ""
> namespace...not find it...then display no action mapping found.
>
>
> Any insight? Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Ken McWilliams
In reply to this post by John Patrick
What he explains is likely the result of a search action also mapped in the
default namespace.
On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:

>
> Not seen this happen myself, what strut
>
> Not seen this happen myself, what struts jar's do you have as it might be
> something like the convention plugin...
>
> If your using maven then it might be useful for others to include what
> specific maven dependencies your including so potentially someone else can
> try using the exact same jars.
>
> John
>
>
>
> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
>
> > Hello,
> > I have been using struts 2.1.8 for a while and last night noticed an
> issue
> > with mapping actions working with any url.
> >
> > For instance in the struts.xml file:
> > - I have a package with a namespace of "/employee".
> > - Within the package, I have an action mapping "search"
> > - The webapp name is "TestWeb".
> >
> > So to access this page, I can go to:
> > http://localhost:8080/TestWeb/employee/search.action and this works.
> > However, if anything is added to the URL after the namespace such as:
> > http://localhost:8080/TestWeb/employee/someExtraText/search.action the
> > page still loads.
> >
> > Why does this happen?
> >
> >
> > Reading the struts documentation
> > (
> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> > would make me assume that it should search the "/employee/someExtraText"
> > namespace...not find it, so then it should fall back to the default ""
> > namespace...not find it...then display no action mapping found.
> >
> >
> > Any insight? Thanks!
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Matt Williams
In reply to this post by Matt Williams


No, there are no other 'search' actions defined anywhere else.



------------------------------
On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:

>What he explains is likely the result of a search action also mapped in the
>default namespace.
>On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
>>
>> Not seen this happen myself, what strut
>>
>> Not seen this happen myself, what struts jar's do you have as it might be
>> something like the convention plugin...
>>
>> If your using maven then it might be useful for others to include what
>> specific maven dependencies your including so potentially someone else can
>> try using the exact same jars.
>>
>> John
>>
>>
>>
>> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
>>
>> > Hello,
>> > I have been using struts 2.1.8 for a while and last night noticed an
>> issue
>> > with mapping actions working with any url.
>> >
>> > For instance in the struts.xml file:
>> > - I have a package with a namespace of "/employee".
>> > - Within the package, I have an action mapping "search"
>> > - The webapp name is "TestWeb".
>> >
>> > So to access this page, I can go to:
>> > http://localhost:8080/TestWeb/employee/search.action and this works.
>> > However, if anything is added to the URL after the namespace such as:
>> > http://localhost:8080/TestWeb/employee/someExtraText/search.action the
>> > page still loads.
>> >
>> > Why does this happen?
>> >
>> >
>> > Reading the struts documentation
>> > (
>> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
>> > would make me assume that it should search the "/employee/someExtraText"
>> > namespace...not find it, so then it should fall back to the default "
>> > namespace...not find it...then display no action mapping found.
>> >
>> >
>> > Any insight? Thanks!
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>> >
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Lukasz Lenart
Can you share your struts.xml file?

Maybe you have defined default-action-ref or wildcard mapping?

2014-05-24 18:58 GMT+02:00 Matt Williams <[hidden email]>:

>
>
> No, there are no other 'search' actions defined anywhere else.
>
>
>
> ------------------------------
> On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:
>
>>What he explains is likely the result of a search action also mapped in the
>>default namespace.
>>On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
>>>
>>> Not seen this happen myself, what strut
>>>
>>> Not seen this happen myself, what struts jar's do you have as it might be
>>> something like the convention plugin...
>>>
>>> If your using maven then it might be useful for others to include what
>>> specific maven dependencies your including so potentially someone else can
>>> try using the exact same jars.
>>>
>>> John
>>>
>>>
>>>
>>> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
>>>
>>> > Hello,
>>> > I have been using struts 2.1.8 for a while and last night noticed an
>>> issue
>>> > with mapping actions working with any url.
>>> >
>>> > For instance in the struts.xml file:
>>> > - I have a package with a namespace of "/employee".
>>> > - Within the package, I have an action mapping "search"
>>> > - The webapp name is "TestWeb".
>>> >
>>> > So to access this page, I can go to:
>>> > http://localhost:8080/TestWeb/employee/search.action and this works.
>>> > However, if anything is added to the URL after the namespace such as:
>>> > http://localhost:8080/TestWeb/employee/someExtraText/search.action the
>>> > page still loads.
>>> >
>>> > Why does this happen?
>>> >
>>> >
>>> > Reading the struts documentation
>>> > (
>>> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
>>> > would make me assume that it should search the "/employee/someExtraText"
>>> > namespace...not find it, so then it should fall back to the default "
>>> > namespace...not find it...then display no action mapping found.
>>> >
>>> >
>>> > Any insight? Thanks!
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: [hidden email]
>>> > For additional commands, e-mail: [hidden email]
>>> >
>>> >
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Dave Newton-6
This isn't the struts.enable.SlashesInActionNames = false setting?

Dave



On Sat, May 24, 2014 at 2:50 PM, Lukasz Lenart <[hidden email]>wrote:

> Can you share your struts.xml file?
>
> Maybe you have defined default-action-ref or wildcard mapping?
>
> 2014-05-24 18:58 GMT+02:00 Matt Williams <[hidden email]>:
> >
> >
> > No, there are no other 'search' actions defined anywhere else.
> >
> >
> >
> > ------------------------------
> > On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:
> >
> >>What he explains is likely the result of a search action also mapped in
> the
> >>default namespace.
> >>On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
> >>>
> >>> Not seen this happen myself, what strut
> >>>
> >>> Not seen this happen myself, what struts jar's do you have as it might
> be
> >>> something like the convention plugin...
> >>>
> >>> If your using maven then it might be useful for others to include what
> >>> specific maven dependencies your including so potentially someone else
> can
> >>> try using the exact same jars.
> >>>
> >>> John
> >>>
> >>>
> >>>
> >>> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
> >>>
> >>> > Hello,
> >>> > I have been using struts 2.1.8 for a while and last night noticed an
> >>> issue
> >>> > with mapping actions working with any url.
> >>> >
> >>> > For instance in the struts.xml file:
> >>> > - I have a package with a namespace of "/employee".
> >>> > - Within the package, I have an action mapping "search"
> >>> > - The webapp name is "TestWeb".
> >>> >
> >>> > So to access this page, I can go to:
> >>> > http://localhost:8080/TestWeb/employee/search.action and this works.
> >>> > However, if anything is added to the URL after the namespace such as:
> >>> > http://localhost:8080/TestWeb/employee/someExtraText/search.actionthe
> >>> > page still loads.
> >>> >
> >>> > Why does this happen?
> >>> >
> >>> >
> >>> > Reading the struts documentation
> >>> > (
> >>>
> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> >>> > would make me assume that it should search the
> "/employee/someExtraText"
> >>> > namespace...not find it, so then it should fall back to the default "
> >>> > namespace...not find it...then display no action mapping found.
> >>> >
> >>> >
> >>> > Any insight? Thanks!
> >>> >
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: [hidden email]
> >>> > For additional commands, e-mail: [hidden email]
> >>> >
> >>> >
> >>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
e: [hidden email]
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Matt Williams
Here is my struts.xml file:

<struts>
    <package name="default" extends="tiles-default">
        <action name="Welcome" class="com.company.actions.WelcomeAction">
            <result name="success" type="dispatcher" >/Welcome.jsp</result>   
        </action>
    </package>   

    <package name="employee-pkg" namespace="/employee" extends="tiles-default">
        <action name="Search" class="com.company.actions.SearchAction">
            <result name="success" type="dispatcher" >/Search.jsp</result>   
        </action>
    </package>
</struts>






On Saturday, May 24, 2014 8:51 PM, Dave Newton <[hidden email]> wrote:
This isn't the struts.enable.SlashesInActionNames = false setting?

Dave






On Sat, May 24, 2014 at 2:50 PM, Lukasz Lenart <[hidden email]>wrote:

> Can you share your struts.xml file?
>
> Maybe you have defined default-action-ref or wildcard mapping?
>
> 2014-05-24 18:58 GMT+02:00 Matt Williams <[hidden email]>:
> >
> >
> > No, there are no other 'search' actions defined anywhere else.
> >
> >
> >
> > ------------------------------
> > On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:
> >
> >>What he explains is likely the result of a search action also mapped in
> the
> >>default namespace.
> >>On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
> >>>
> >>> Not seen this happen myself, what strut
> >>>
> >>> Not seen this happen myself, what struts jar's do you have as it might
> be
> >>> something like the convention plugin...
> >>>
> >>> If your using maven then it might be useful for others to include what
> >>> specific maven dependencies your including so potentially someone else
> can
> >>> try using the exact same jars.
> >>>
> >>> John
> >>>
> >>>
> >>>
> >>> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
> >>>
> >>> > Hello,
> >>> > I have been using struts 2.1.8 for a while and last night noticed an
> >>> issue
> >>> > with mapping actions working with any url.
> >>> >
> >>> > For instance in the struts.xml file:
> >>> > - I have a package with a namespace of "/employee".
> >>> > - Within the package, I have an action mapping "search"
> >>> > - The webapp name is "TestWeb".
> >>> >
> >>> > So to access this page, I can go to:
> >>> > http://localhost:8080/TestWeb/employee/search.action and this works.
> >>> > However, if anything is added to the URL after the namespace such as:
> >>> > http://localhost:8080/TestWeb/employee/someExtraText/search.actionthe
> >>> > page still loads.
> >>> >
> >>> > Why does this happen?
> >>> >
> >>> >
> >>> > Reading the struts documentation
> >>> > (
> >>>
> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> >>> > would make me assume that it should search the
> "/employee/someExtraText"
> >>> > namespace...not find it, so then it should fall back to the default "
> >>> > namespace...not find it...then display no action mapping found.
> >>> >
> >>> >
> >>> > Any insight? Thanks!
> >>> >
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: [hidden email]
> >>> > For additional commands, e-mail: [hidden email]
> >>> >
> >>> >
> >>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
e: [hidden email]
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Matt Williams
In reply to this post by Matt Williams


I found the following property: struts.mapper.alwaysSelectFullNamespace (which is false by default).

To me, it should be 'true' to match how the documentation explains matching actions to namespaces and falling back to default namespace.





------------------------------
On Sat, May 24, 2014 8:51 PM CDT Dave Newton wrote:

>This isn't the struts.enable.SlashesInActionNames = false setting?
>
>Dave
>
>
>
>On Sat, May 24, 2014 at 2:50 PM, Lukasz Lenart <[hidden email]>wrote:
>
>> Can you share your struts.xml file?
>>
>> Maybe you have defined default-action-ref or wildcard mapping?
>>
>> 2014-05-24 18:58 GMT+02:00 Matt Williams <[hidden email]>:
>> >
>> >
>> > No, there are no other 'search' actions defined anywhere else.
>> >
>> >
>> >
>> > ------------------------------
>> > On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:
>> >
>> >What he explains is likely the result of a search action also mapped in
>> the
>> >default namespace.
>> >On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
>> >>
>> >> Not seen this happen myself, what strut
>> >>
>> >> Not seen this happen myself, what struts jar's do you have as it might
>> be
>> >> something like the convention plugin...
>> >>
>> >> If your using maven then it might be useful for others to include what
>> >> specific maven dependencies your including so potentially someone else
>> can
>> >> try using the exact same jars.
>> >>
>> >> John
>> >>
>> >>
>> >>
>> >> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
>> >>
>> >> > Hello,
>> >> > I have been using struts 2.1.8 for a while and last night noticed an
>> >> issue
>> >> > with mapping actions working with any url.
>> >> >
>> >> > For instance in the struts.xml file:
>> >> > - I have a package with a namespace of "/employee".
>> >> > - Within the package, I have an action mapping "search"
>> >> > - The webapp name is "TestWeb".
>> >> >
>> >> > So to access this page, I can go to:
>> >> > http://localhost:8080/TestWeb/employee/search.action and this works.
>> >> > However, if anything is added to the URL after the namespace such as:
>> >> > http://localhost:8080/TestWeb/employee/someExtraText/search.actionthe
>> >> > page still loads.
>> >> >
>> >> > Why does this happen?
>> >> >
>> >> >
>> >> > Reading the struts documentation
>> >> > (
>> >>
>> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
>> >> > would make me assume that it should search the
>> "/employee/someExtraText"
>> >> > namespace...not find it, so then it should fall back to the default "
>> >> > namespace...not find it...then display no action mapping found.
>> >> >
>> >> >
>> >> > Any insight? Thanks!
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: [hidden email]
>> >> > For additional commands, e-mail: [hidden email]
>> >> >
>> >> >
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
>--
>e: [hidden email]
>m: 908-380-8699
>s: davelnewton_skype
>t: @dave_newton <https://twitter.com/dave_newton>
>b: Bucky Bits <http://buckybits.blogspot.com/>
>g: davelnewton <https://github.com/davelnewton>
>so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Ralph Grove
Matt, did this solve your problem? I'm having the same issue with namespaces. With this example, I can request ".../Home", ".../Home/Alpha", ".../Alpha/Alpha/Alpha", etc.    The action executes in each case, but if the URL contains more than one slash, the relative path is messed up for files included in the JSP.

Ralph Grove

<!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.mapper.alwaysSelectFullNamespace" value="true" />
    <constant name="struts.enable.SlashesInActionNames" value="false" />
   
    <package name="main" extends="struts-default">  
        <default-action-ref name="NotFound"/>
       
        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>
 
        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="error"/>
        </global-exception-mappings>
 
        <action name="NotFound">
            <result>/error.jsp</result>
        </action>
   
        <!-- Sidebar menu item and static link actions -->
        <action name="Home" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/index.jsp</result>
        </action>
        <action name="Alpha" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/alpha.jsp</result>
        </action>
        <action name="Beta" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/beta.jsp</result>
        </action>

                               
        <!-- Actions -->
        <action name="AnAction" class="action.AnAction">
            <result name="success">/WEB-INF/jsp/index.jsp</result>
            <result name="input">/WEB-INF/jsp/beta.jsp</result>
        </action>
       
    </package>
</struts>

On 2014-05-28 21:03 (-0400), Matt Williams <[hidden email]> wrote:

>
>
> I found the following property: struts.mapper.alwaysSelectFullNamespace (which is false by default).
>
> To me, it should be 'true' to match how the documentation explains matching actions to namespaces and falling back to default namespace.
>
>
>
>
>
> ------------------------------
> On Sat, May 24, 2014 8:51 PM CDT Dave Newton wrote:
>
> >This isn't the struts.enable.SlashesInActionNames = false setting?
> >
> >Dave
> >
> >
> >
> >On Sat, May 24, 2014 at 2:50 PM, Lukasz Lenart <[hidden email]>wrote:
> >
> >> Can you share your struts.xml file?
> >>
> >> Maybe you have defined default-action-ref or wildcard mapping?
> >>
> >> 2014-05-24 18:58 GMT+02:00 Matt Williams <[hidden email]>:
> >> >
> >> >
> >> > No, there are no other 'search' actions defined anywhere else.
> >> >
> >> >
> >> >
> >> > ------------------------------
> >> > On Sat, May 24, 2014 11:46 AM CDT Ken McWilliams wrote:
> >> >
> >> >What he explains is likely the result of a search action also mapped in
> >> the
> >> >default namespace.
> >> >On 2014-05-24 9:35 AM, "John Patrick" <[hidden email]> wrote:
> >> >>
> >> >> Not seen this happen myself, what strut
> >> >>
> >> >> Not seen this happen myself, what struts jar's do you have as it might
> >> be
> >> >> something like the convention plugin...
> >> >>
> >> >> If your using maven then it might be useful for others to include what
> >> >> specific maven dependencies your including so potentially someone else
> >> can
> >> >> try using the exact same jars.
> >> >>
> >> >> John
> >> >>
> >> >>
> >> >>
> >> >> On 24 May 2014 15:28, Matt Williams <[hidden email]> wrote:
> >> >>
> >> >> > Hello,
> >> >> > I have been using struts 2.1.8 for a while and last night noticed an
> >> >> issue
> >> >> > with mapping actions working with any url.
> >> >> >
> >> >> > For instance in the struts.xml file:
> >> >> > - I have a package with a namespace of "/employee".
> >> >> > - Within the package, I have an action mapping "search"
> >> >> > - The webapp name is "TestWeb".
> >> >> >
> >> >> > So to access this page, I can go to:
> >> >> > http://localhost:8080/TestWeb/employee/search.action and this works.
> >> >> > However, if anything is added to the URL after the namespace such as:
> >> >> > http://localhost:8080/TestWeb/employee/someExtraText/search.actionthe
> >> >> > page still loads.
> >> >> >
> >> >> > Why does this happen?
> >> >> >
> >> >> >
> >> >> > Reading the struts documentation
> >> >> > (
> >> >>
> >> http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
> >> >> > would make me assume that it should search the
> >> "/employee/someExtraText"
> >> >> > namespace...not find it, so then it should fall back to the default "
> >> >> > namespace...not find it...then display no action mapping found.
> >> >> >
> >> >> >
> >> >> > Any insight? Thanks!
> >> >> >
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: [hidden email]
> >> >> > For additional commands, e-mail: [hidden email]
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [hidden email]
> >> > For additional commands, e-mail: [hidden email]
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
> >
> >--
> >e: [hidden email]
> >m: 908-380-8699
> >s: davelnewton_skype
> >t: @dave_newton <https://twitter.com/dave_newton>
> >b: Bucky Bits <http://buckybits.blogspot.com/>
> >g: davelnewton <https://github.com/davelnewton>
> >so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Lukasz Lenart
2017-04-27 13:56 GMT+02:00 Ralph Grove <[hidden email]>:

> Matt, did this solve your problem? I'm having the same issue with namespaces. With this example, I can request ".../Home", ".../Home/Alpha", ".../Alpha/Alpha/Alpha", etc.    The action executes in each case, but if the URL contains more than one slash, the relative path is messed up for files included in the JSP.
>
> Ralph Grove
>
> <!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.mapper.alwaysSelectFullNamespace" value="true" />
>     <constant name="struts.enable.SlashesInActionNames" value="false" />
>
>     <package name="main" extends="struts-default">
>         <default-action-ref name="NotFound"/>
>
>         <global-results>
>             <result name="error">/error.jsp</result>
>         </global-results>
>
>         <global-exception-mappings>
>             <exception-mapping exception="java.lang.Exception" result="error"/>
>         </global-exception-mappings>
>
>         <action name="NotFound">
>             <result>/error.jsp</result>
>         </action>
>
>         <!-- Sidebar menu item and static link actions -->
>         <action name="Home" class="com.opensymphony.xwork2.ActionSupport">
>             <result>/WEB-INF/jsp/index.jsp</result>
>         </action>
>         <action name="Alpha" class="com.opensymphony.xwork2.ActionSupport">
>             <result>/WEB-INF/jsp/alpha.jsp</result>
>         </action>
>         <action name="Beta" class="com.opensymphony.xwork2.ActionSupport">
>             <result>/WEB-INF/jsp/beta.jsp</result>
>         </action>
>
>
>         <!-- Actions -->
>         <action name="AnAction" class="action.AnAction">
>             <result name="success">/WEB-INF/jsp/index.jsp</result>
>             <result name="input">/WEB-INF/jsp/beta.jsp</result>
>         </action>
>
>     </package>
> </struts>

I assume you don't use the Convention plugin also what version do you use?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Struts2 namespace confusion

Ralph Grove


On 2017-04-28 04:33 (-0400), Lukasz Lenart <[hidden email]> wrote:

> 2017-04-27 13:56 GMT+02:00 Ralph Grove <[hidden email]>:
> > Matt, did this solve your problem? I'm having the same issue with namespaces. With this example, I can request ".../Home", ".../Home/Alpha", ".../Alpha/Alpha/Alpha", etc.    The action executes in each case, but if the URL contains more than one slash, the relative path is messed up for files included in the JSP.
> >
> > Ralph Grove
> >
> > <!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.mapper.alwaysSelectFullNamespace" value="true" />
> >     <constant name="struts.enable.SlashesInActionNames" value="false" />
> >
> >     <package name="main" extends="struts-default">
> >         <default-action-ref name="NotFound"/>
> >
> >         <global-results>
> >             <result name="error">/error.jsp</result>
> >         </global-results>
> >
> >         <global-exception-mappings>
> >             <exception-mapping exception="java.lang.Exception" result="error"/>
> >         </global-exception-mappings>
> >
> >         <action name="NotFound">
> >             <result>/error.jsp</result>
> >         </action>
> >
> >         <!-- Sidebar menu item and static link actions -->
> >         <action name="Home" class="com.opensymphony.xwork2.ActionSupport">
> >             <result>/WEB-INF/jsp/index.jsp</result>
> >         </action>
> >         <action name="Alpha" class="com.opensymphony.xwork2.ActionSupport">
> >             <result>/WEB-INF/jsp/alpha.jsp</result>
> >         </action>
> >         <action name="Beta" class="com.opensymphony.xwork2.ActionSupport">
> >             <result>/WEB-INF/jsp/beta.jsp</result>
> >         </action>
> >
> >
> >         <!-- Actions -->
> >         <action name="AnAction" class="action.AnAction">
> >             <result name="success">/WEB-INF/jsp/index.jsp</result>
> >             <result name="input">/WEB-INF/jsp/beta.jsp</result>
> >         </action>
> >
> >     </package>
> > </struts>
>
> I assume you don't use the Convention plugin also what version do you use?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>


Actually, your solution did work - I just forgot to define the root namespace. Here's my corrected struts.xml, which does treat extended URL's (e.g., .../Alpha/Alpha) as errors.

I'm using version 2.5.10.1 of the core library.

Ralph

<!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.mapper.alwaysSelectFullNamespace" value="true" />
    <constant name="struts.enable.SlashesInActionNames" value="false" />
   
    <package name="default" extends="struts-default">  
        <default-action-ref name="NotFound"/>
       
        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>
 
        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="error"/>
        </global-exception-mappings>
 
        <action name="NotFound">
            <result type="redirect">/error.jsp</result>
        </action>
    </package>
       
    <package name="root" extends="struts-default" namespace="/">    
        <!-- Sidebar menu item and static link actions -->
        <action name="Home" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/index.jsp</result>
        </action>
        <action name="Alpha" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/alpha.jsp</result>
        </action>
        <action name="Beta" class="com.opensymphony.xwork2.ActionSupport">
            <result>/WEB-INF/jsp/beta.jsp</result>
        </action>

                               
        <!-- Actions -->
        <action name="AnAction" class="action.AnAction">
            <result name="success">/WEB-INF/jsp/index.jsp</result>
            <result name="input">/WEB-INF/jsp/beta.jsp</result>
        </action>
       
    </package>
</struts>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...