struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulbrickell <paul.brick...@evolvedintelligence.com>
Subject Re: actions defined in a package are visible in other packages??
Date Fri, 01 Feb 2008 18:57:00 GMT

laurie,

I have examples of one page in a namespace invoking actions in the same
namespace and now I know how to call across to it from my root it all looks
good.

My problem is that I want to use actions in the target namespace from my
root namespace as simple links.

so I think (being a bit of a struts 2 novice) that something like...

<div>
<a: href="/some-namespace/do.action"/>other-domain 
</div>

might not be reasonable.

However when I click such a link I get no activity at all. I have breakpoint
in first the interceptor (acegi security as it happens) but there is no call
and looking at the browser source it shows no content in the div (firefox on
linux btw).

I might also want to pass the url to some Javascript to invoke a call for
some JSON or god forfend some XML. e.g.

<s:url namespace="some-namespace" name="do" var="theURL"/>
onClick="call('<s:property name="theURL">')"

In fact I have tried this and I get the same behaviour as the div example. A
console.debug of the value of the param shows a partial url in the form
"/some-namespace/do.action". But I get nothing on the server.

Its just plain odd. I am gonna have to do some more looking. I just know I
am doing something wrong here and when I find myself sniffing network
packets I'm certain.

Still if I had a life I probably wouldn't care. The search goes on:-P

Cheers,
Paul B


Laurie Harper wrote:
> 
> http://struts.apache.org/2.0.11/docs/action.html
> 
> Did you try <s:action namespace="/some-namespace" action="myAction" 
> executeResult="true"/>? If the namespace of the action that renders this 
> page is also some-namespace you should be able to leave out the 
> namespace attribute, too, and just use action="myAction".
> 
> L.
> 
> paulbrickell wrote:
>> Cool the docs would make life easier for us poor saps.
>> 
>> I don't think I was clear about what I am seeing. If I have an action tag
>> in
>> my page like this...
>> 
>> <div>
>> <s:action name="/some-namespace/myAction" executeResult="true"/>
>> </div>
>> 
>> And a struts.xml file that defines a package with the namespace
>> 'some-namespace' that contains an action called myAction I see no call to
>> the target action (I am debugging and have a breakpoint in my action). I
>> simply get a blank space in my output. However if I past a full url in my
>> browser e.g. http://x.y.org/myApp/some-namespace/myAction.action all is
>> well.
>> 
>> Weird.
>> 
>> 
>> 
>> newton.dave wrote:
>>> --- paulbrickell <paul.brickell@evolvedintelligence.com> wrote:
>>>> I had seen those, but the problem I was having was that at no point in
>>>> the
>>>> docs (afaik) is there an example of a URL to actually target an action
>>>> in
>>>> a
>>>> namespace.
>>> Noted, although the <s:action...> [1] and <s:url...>[2] tag
>>> documentation
>>> does list the "namespace" attribute. I've added a task to add explicit
>>> examples.
>>>
>>>> Do not seem to work. However like this...
>>>>
>>>> <s:action name="do" namespace="space"/>
>>>>
>>>> does. 
>>>>
>>>> Annoyingly this...
>>>>
>>>> <s:action name="do.action" namespace="space"/> 
>>>>
>>>> doesn't seem to work either.
>>> Correct, appending the prefix to <s:action...>, which already assumes
>>> you're
>>> referring to an action, wouldn't work.
>>>
>>>> And don't even get me started about using namespaced actions with the a
>>>> tag. href="/space/do" doesn't work either.
>>> Well, no, "href" is for a URL, not an action, and the docs explicitly
>>> build
>>> the URL with <s:url...>
>>>
>>>> And the final insult when the actions don't resolve properly it fails
>>>> silently and all I get is an empty browser.:-/
>>> I haven't seen that; do you have "devMode" turned on? Under what
>>> circumstances do you get an empty browser?
>>>
>>> Dave
>>>
>>> [1] http://struts.apache.org/2.x/docs/action.html
>>> [2] http://struts.apache.org/2.x/docs/url.html
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/actions-defined-in-a-package-are-visible-in-other-packages---tp11277458p15231865.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


Mime
View raw message