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 Sat, 02 Feb 2008 19:45:49 GMT

Dave,
Thanks for the help here. I see the same thing happening now. 

If I have a leading slash in my config file I can create a link with both
and action and a url but the action tag then only works if I have a leading
slash. If I dont then I get the 'cannot find action' error. 

I can create a url tag with or without a leading slash.

If I dont have a leading slash in the namespace attribute in the config file
I cannot create a url at all.

It may be inconsistent. It maybe documented that way. It may be the case
that this demonstrates the correct semantics for both the url and action
tags, I don't know. I do know that I can make progress now and that makes me
happy.

I do wonder if this is correct. I am gonna have a good long look at docs
again and see.

Thanks all for the feedback. Especially Dave N.

Paul B.



newton.dave wrote:
> 
> I can only dupe this if I leave out the leading "/" (slash) in my
> namespace
> attribute of my package.
> 
> Off the top of my head I'd say that the dispatcher is looking in a "/"
> namespace (as opposed to the "" (empty string) namespace) and can't find
> the
> action there (or is looking in "" instead of "/", maybe).
> 
> If you use the leading "/" in your namespace attribute (both in your S2
> config file and in the tags) it should work. (Although I just tried it
> only
> in config and not in the tag and that worked too, but I wouldn't recommend
> it.)
> 
> Dave
> 
> --- paulbrickell <paul.brickell@evolvedintelligence.com> wrote:
> 
>> 
>> Dave,
>> 
>> OK did as you suggested, cranked up the logging level and I do now get
>> some
>> logging. I created a little sandbox app to test out some things with and
>> simplifying has really helped. Heres what I have now
>> 
>> <div>
>>   <s:action name="test" namespace="secondary" executeResult="true"/>
>> </div>
>> <div>
>>   <s:action name="secondary/test.action" executeResult="true"/>
>> </div>
>> <div>
>>   <s:url id="testUrlId" namespace="secondary" action="test"/>
>>   <s:a href="%{testUrlId}">execute test action</s:a>
>> </div>
>> 
>> 
>> Now the first div works exactly as expected. 
>> 
>> The second one also works how would expect it to. It Always generates a
>> stack trace with the error message "There is no Action mapped for action
>> name secondary/test.ation" regardless of how I try to specify the 'path'
>> to
>> the action. Now I know that the namespace does not represent a path and
>> that
>> I need to use the namespace attribute. I think thats fine and that
>> doesn't
>> give me any kind of problem. I can always specify the namespace attribute
>> and all is well.
>> 
>> But the third div is my problem. There seems to be no way a can form a
>> URL
>> for s:a tag that lets me build a link to the namespaced action. The link
>> directs the browser to...
>> 
>> http://localhost:8080/sandbox/secondary/test.action
>> 
>> That seems ok to me. but when I click this link I get this...
>> 
>> [example] DEBUG [http-8080-1] DefaultActionProxy.<init>(65) | Creating an
>> DefaultActionProxy for namespace  and action name test
>> [example] ERROR [http-8080-1] Dispatcher.serviceAction(512) | Could not
>> find
>> action or result
>> There is no Action mapped for action name test. - [unknown location]
>> 	at
>>
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
>> 	at
>>
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
>> 	at
>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
>> 	at
>>
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
>> 	at
>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> 	at
>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> 	at
>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> 	at
>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>> 	at
>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> 	at
>>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> 	at
>>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> 	at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>> 	at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>> 	at
>>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
>> 	at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>> 	at java.lang.Thread.run(Unknown Source)
>> 
>> 
>> (Hope its OK to dump stacktraces here, apologies if its bad form).
>> 
>> it seems from the debug line "[example] DEBUG [http-8080-1]
>> DefaultActionProxy.<init>(65) | Creating an DefaultActionProxy for
>> namespace 
>> and action name test" That there is no namespace defined. I will try to
>> step
>> throught the DefaultActionProxy next to find out why that might be.
>> 
>> If thats correct (the link represents a path after all), am I going to
>> have
>> to have all my links in the root namespace? I can do this of course, but
>> it
>> seems a ilttle restrictive.
>> 
>> Just have to say thanks for all the feedback. I am always impressed with
>> the
>> help given on these lists.
>> 
>> Paul B.
>> 
>> 
>> 
>> newton.dave wrote:
>> > 
>> > --- paulbrickell <paul.brickell@evolvedintelligence.com> wrote:
>> >> 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.
>> > 
>> > Yeah, that's a little weird. If you turn up the logging is there
>> anything
>> > on
>> > the console? I mean, clearly it'll work w/ the proper use of the
>> > "namespace"
>> > attribute etc. but something on the console might be handy if it isn't
>> > already there.
>> > 
>> > Dave
>> > 
>> > 
>> > ---------------------------------------------------------------------
>> > 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---tp11277458p15242369.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
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> 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---tp11277458p15246441.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