struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgai...@hotmail.com
Subject Re: actions defined in a package are visible in other packages??
Date Sat, 02 Feb 2008 14:51:08 GMT
not off base at all..
one example is to reference WEB-INF/classes/struts-tags-ui.xml

 <package name="ui-tags" extends="struts-default" namespace="/tags/ui">
        <action name="example"
class="org.apache.struts2.showcase.UITagExample">
            <result>example.jsp</result>
            <result name="input">example.jsp</result>
        </action>

which resolves the default result of example.jsp to /tags/ui/example.jsp
specifically..
$TOMCAT_HOME/webapps/struts2-showcase-2.0.11/tags/ui/example.jsp

HTH
Martin--
----- Original Message -----
Wrom: PKYLEJGDGVCJVTLBXFGGMEPYOQKEDOTWFAO
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Saturday, February 02, 2008 8:54 AM
Subject: Re: actions defined in a package are visible in other packages??


> I'm jumping into this thread late, so I apologize if I'm way off-base.
> But, is there a reason why you aren't using a front-slash in your
> namespace names? Although the docs don't explicitly say it is required,
> a leading / seems to show up in each example in the docs.
>
> http://struts.apache.org/2.x/docs/namespace-configuration.html
>
> I would try -
> <div>
>   <s:url id="testUrlId" namespace="/secondary" action="test"/>
>   <s:a href="%{testUrlId}">execute test action</s:a>
> </div>
>
> On Sat, 2008-02-02 at 04:25 -0800, paulbrickell 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:1
86)
> > at
> >
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsAct
ionProxyFactory.java:41)
> > at
> >
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
> > at
> >
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:419)
> > at
> >
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)
> > at
> >
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
> > at
> >
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:233)
> > at
> >
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va: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(Http
11Protocol.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
> > >
> > >
> > >
> >
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message