RE: any struts 2 unit testers out there?
Yes, I did discuss the pros and cons of them in this post http://www.nabble.com/any-struts-2-unit-testers-out-there--to13437046.html#a16490696 Cheers, Paul B. dkarr wrote: And did you investigate using either of the common Java frameworks for Mock objects, jMock and EasyMock? -Original Message- From: paulbrickell [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2008 3:04 AM To: user@struts.apache.org Subject: RE: any struts 2 unit testers out there? Actually thats an interesting post. To my mind it doesn't demonstrate a solution. It demonstrates the problem. Here is why I think this. Struts 2 is just frankly brilliant for people doing test first development. The classes you create really are POJOs. There are no dependencies on any framework in my action classes. For example parameters are parsed well away from my action and the values are set using simple properties, things like sessions are simply maps. It is a truly new world for those of who have suffered the horror of mocking http requests, responses, context and the like. But this simple scenario brings all that pain flooding back. I add a line in my action like this... String yadaYada = getText(some.doodad); And my lovely world comes unraveled real quick. Now I need mock objects up the ying-yang. I started using the tutorial from the link posted (I am an Arsenal fan btw, so got two for the price of one, thanks), but it still doesn't provide a simple solution to the problem. To get this to work I have to build not just the application context but a mass of supporting objects to get a (partial) web application framework up and running before I can test my simple POJO. I am not going to give up just yet, but I think I am still going to have to look for another way. Cheers, Paul B. Relph,Brian wrote: I recommend creating an action context. Here is the basic guide I followed to do so: http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring- junit/ If you are not using spring or the struts2 spring plugin, you can cut out all the code around the applicationContext. -Original Message- From: paulbrickell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 11:44 AM To: user@struts.apache.org Subject: Re: any struts 2 unit testers out there? I am trying to deal with the same issue. Did you get any resolution? Following on from the reply asking for a stack trace, here is what I am getting... java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(Locali zedTextUtil.java:299) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProvid erSupport.java:172) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProvid erSupport.java:87) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:80) SNIP at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess orImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth odAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRo adie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThen Afters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod( JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4 ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4Class Runner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoa die.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadi e.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRu nner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestEx ecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest s(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest s(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Rem oteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest Runner.java:196
Re: any struts 2 unit testers out there?
Yeah, I think for the moment I will simply override the getText method. The other solutions do require much more effort. Actually I did not search Jira. Maybe there is already a request. I will take a look. Thanks, Paul B. Laurie Harper wrote: As Ian says, the mock objects supplied by XWork may make this all a lot easier, but in any case all this is predicated on the fact that you're using ActionSupport's implementation of TextProvider which doesn't make provision for mocking at test time. I think it would make a great deal of sense to improve that (open an enhancement request in Jira), but in the mean time, there's nothing preventing you from providing a getText() implementation that's more conducive to testing. I feel your pain on this one, and the right solution is to fix the framework (patches always welcome ;-), but it shouldn't be that hard to get around. L. paulbrickell wrote: Actually thats an interesting post. To my mind it doesn't demonstrate a solution. It demonstrates the problem. Here is why I think this. Struts 2 is just frankly brilliant for people doing test first development. The classes you create really are POJOs. There are no dependencies on any framework in my action classes. For example parameters are parsed well away from my action and the values are set using simple properties, things like sessions are simply maps. It is a truly new world for those of who have suffered the horror of mocking http requests, responses, context and the like. But this simple scenario brings all that pain flooding back. I add a line in my action like this... String yadaYada = getText(some.doodad); And my lovely world comes unraveled real quick. Now I need mock objects up the ying-yang. I started using the tutorial from the link posted (I am an Arsenal fan btw, so got two for the price of one, thanks), but it still doesn't provide a simple solution to the problem. To get this to work I have to build not just the application context but a mass of supporting objects to get a web application framework up and running before I can test my simple POJO. I am not going to give up just yet, but I think I am still going to have to look for another way. Cheers, Paul B. Relph,Brian wrote: I recommend creating an action context. Here is the basic guide I followed to do so: http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/ If you are not using spring or the struts2 spring plugin, you can cut out all the code around the applicationContext. -Original Message- From: paulbrickell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 11:44 AM To: user@struts.apache.org Subject: Re: any struts 2 unit testers out there? I am trying to deal with the same issue. Did you get any resolution? Following on from the reply asking for a stack trace, here is what I am getting... java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:299) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:172) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:87) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:80) SNIP at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460
RE: any struts 2 unit testers out there?
Actually thats an interesting post. To my mind it doesn't demonstrate a solution. It demonstrates the problem. Here is why I think this. Struts 2 is just frankly brilliant for people doing test first development. The classes you create really are POJOs. There are no dependencies on any framework in my action classes. For example parameters are parsed well away from my action and the values are set using simple properties, things like sessions are simply maps. It is a truly new world for those of who have suffered the horror of mocking http requests, responses, context and the like. But this simple scenario brings all that pain flooding back. I add a line in my action like this... String yadaYada = getText(some.doodad); And my lovely world comes unraveled real quick. Now I need mock objects up the ying-yang. I started using the tutorial from the link posted (I am an Arsenal fan btw, so got two for the price of one, thanks), but it still doesn't provide a simple solution to the problem. To get this to work I have to build not just the application context but a mass of supporting objects to get a web application framework up and running before I can test my simple POJO. I am not going to give up just yet, but I think I am still going to have to look for another way. Cheers, Paul B. Relph,Brian wrote: I recommend creating an action context. Here is the basic guide I followed to do so: http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/ If you are not using spring or the struts2 spring plugin, you can cut out all the code around the applicationContext. -Original Message- From: paulbrickell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 11:44 AM To: user@struts.apache.org Subject: Re: any struts 2 unit testers out there? I am trying to deal with the same issue. Did you get any resolution? Following on from the reply asking for a stack trace, here is what I am getting... java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:299) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:172) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:87) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:80) SNIP at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) It is caused by ActionContext.getContext() returning null. Quite obviously I do not have an action context during my unit testing. Now I can certainly use the ActionContext.setContext() in my tests setup method to push one into thread local storage and that works OK. It isn't ideal though because ActionContext is a concrete class and so my choices then become a bit limited. I could create an instance but when I try this I find I have to create a rather large object model to make it actually work. To the point where I despair and give up. Alternatively I could use a mock library (like easy mock). But I am not inclined
RE: any struts 2 unit testers out there?
Actually thats an interesting post. To my mind it doesn't demonstrate a solution. It demonstrates the problem. Here is why I think this. Struts 2 is just frankly brilliant for people doing test first development. The classes you create really are POJOs. There are no dependencies on any framework in my action classes. For example parameters are parsed well away from my action and the values are set using simple properties, things like sessions are simply maps. It is a truly new world for those of who have suffered the horror of mocking http requests, responses, context and the like. But this simple scenario brings all that pain flooding back. I add a line in my action like this... String yadaYada = getText(some.doodad); And my lovely world comes unraveled real quick. Now I need mock objects up the ying-yang. I started using the tutorial from the link posted (I am an Arsenal fan btw, so got two for the price of one, thanks), but it still doesn't provide a simple solution to the problem. To get this to work I have to build not just the application context but a mass of supporting objects to get a (partial) web application framework up and running before I can test my simple POJO. I am not going to give up just yet, but I think I am still going to have to look for another way. Cheers, Paul B. Relph,Brian wrote: I recommend creating an action context. Here is the basic guide I followed to do so: http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/ If you are not using spring or the struts2 spring plugin, you can cut out all the code around the applicationContext. -Original Message- From: paulbrickell [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 11:44 AM To: user@struts.apache.org Subject: Re: any struts 2 unit testers out there? I am trying to deal with the same issue. Did you get any resolution? Following on from the reply asking for a stack trace, here is what I am getting... java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:299) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:172) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:87) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:80) SNIP at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) It is caused by ActionContext.getContext() returning null. Quite obviously I do not have an action context during my unit testing. Now I can certainly use the ActionContext.setContext() in my tests setup method to push one into thread local storage and that works OK. It isn't ideal though because ActionContext is a concrete class and so my choices then become a bit limited. I could create an instance but when I try this I find I have to create a rather large object model to make it actually work. To the point where I despair and give up. Alternatively I could use a mock library (like easy mock). But I am not inclined
Re: any struts 2 unit testers out there?
I am trying to deal with the same issue. Did you get any resolution? Following on from the reply asking for a stack trace, here is what I am getting... java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:299) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:172) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:87) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:80) SNIP at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) It is caused by ActionContext.getContext() returning null. Quite obviously I do not have an action context during my unit testing. Now I can certainly use the ActionContext.setContext() in my tests setup method to push one into thread local storage and that works OK. It isn't ideal though because ActionContext is a concrete class and so my choices then become a bit limited. I could create an instance but when I try this I find I have to create a rather large object model to make it actually work. To the point where I despair and give up. Alternatively I could use a mock library (like easy mock). But I am not inclined to include a mocking library that requires byte code rewriting (not even for testing). What I really want to do is inject a text provider into the ActionSupport class. At the top of the ActionSupport class is this... private final transient TextProvider textProvider = new TextProviderFactory().createInstance(getClass(), this); Damn its final and so I cannot inject my own text provider. BUT it uses a factory, thats good. I know I will have a look at the factory I bet I can monkey with that and inject a mock. Nope. It's all instance based. No way I can get in there. And thats that. Now what do I do? I can see two (half) workable solutions. One is to override the the getText method in the action class when I instantiate it during testing. So I end up doing this in all my action unit tests... Action action = new MyAction() { @Override public String getText(String textName) { return mocked; } }; It works, but its cheese. Or two I can add a level of indirection in my action class, like so... String text = MyTextProviderFactory.getInstance(class.name).getText(some.property); Then I can use a delegate to the real text provider during live code and a mock of my own text provider during testing. The question here is, Why for the love of Pete, why? So in conclusion there are at least four options for testing Action classes that use get text. 1. Build an action context by hand. (Too hard) 2. Use a class rewriting mocking library. (Not on my watch) 3. Mock the get text method. (Cheese) 4. Add another level of indirection. (Man thats just annoying) Comments? BTW If you got this far, thanks for taking the time. Paul B. Session Mwamufiya wrote: Hi All, Would someone let me know whether it's possible to tweak something so
Re: actions defined in a package are visible in other packages??
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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
Re: actions defined in a package are visible in other packages??
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 [EMAIL PROTECTED] 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
Re: actions defined in a package are visible in other packages??
Could you post a link to the section in the docs. I just cant work this out.:confused: Roberto Nunnari wrote: oops.. I should have read the docs a bit more before posting.. sorry.. for the noise! -- Robi. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/actions-defined-in-a-package-are-visible-in-other-packages---tp11277458p15226847.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: actions defined in a package are visible in other packages??
Thanks, 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. Through a (very tedious) process of trial and error I finally stumbled upon a (the?) solution. Actions like these... s:action name=space/do/ s:action name=space/do.action/ s:action name=/space/do/ s:action name=/space/do.action/ 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. And don't even get me started about using namespaced actions with the a tag. href=/space/do doesn't work either. Jeez, I can only think I must be missing something. And the final insult when the actions don't resolve properly it fails silently and all I get is an empty browser.:-/ newton.dave wrote: Oops. --- paulbrickell [EMAIL PROTECTED] wrote: Could you post a link to the section in the docs. I just cant work this out.:confused: Work what out? Packages and namespaces are discussed (at least) at [1, 2]. Dave [1] http://struts.apache.org/2.x/docs/package-configuration.html [2] http://struts.apache.org/2.x/docs/namespace-configuration.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/actions-defined-in-a-package-are-visible-in-other-packages---tp11277458p15229863.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: actions defined in a package are visible in other packages??
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/actions-defined-in-a-package-are-visible-in-other-packages---tp11277458p15230489.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: actions defined in a package are visible in other packages??
Actuallt it not clear to how I might build a link to an action in a namespace if... /namespace/myAction doesn't work. What AM I doing wrong? Cheers, Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/actions-defined-in-a-package-are-visible-in-other-packages---tp11277458p15230795.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: actions defined in a package are visible in other packages??
laurie, I have examples of one page in a namespace invoking action 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. 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 the value of the param shows a partial url in the form /some-namespace/do.action. But I get nothing. 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). 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 fing myself sniffing networks I'm certain. Still if I had a life I probably wouldn't care. The earch 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Thanks for the quick reply. I see the stuff now. However I don't think its gonna be that easy. When I use the sx:head element the template also gives me these... script language=JavaScript type=text/javascript src=/application/struts/ajax/dojoRequire.js/script link rel=stylesheet href=/application/struts/xhtml/styles.css type=text/css/ script language=JavaScript src=/application/struts/xhtml/validation.js type=text/javascript/script script language=JavaScript src=/application/struts/css_xhtml/validation.js type=text/javascript/script which seem to scattered amongst various files in the distribution. I guess I better start pulling them in. I hope I get compatible versions. Bleeding edge eh ;-) Julien RICHARD-2 wrote: Hi, The dojo plugin is embedded in the source struts package. Look at struts2-core-2.0.11.jar\org.apache.struts2\static\dojo Regards On Jan 28, 2008 1:34 PM, paulbrickell [EMAIL PROTECTED] wrote: OK Dave, for those of us who are interested in getting 2.1 working the original poster's question seems entirely relevant. Just what does the line '- include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib' mean. I cannot find any distribution or source for said plugin either. cheers, Paul B. newton.dave wrote: The docs regarding the sx prefix are for S2.1. d. --- greyshine [EMAIL PROTECTED] wrote: Hi out there, I am trying to get a little Ajax running w/ the S2. On the webpage: http://struts.apache.org/2.x/docs/ajax-tags.html it says: - include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib folder. - Add %@ taglib prefix=sx uri=/struts-dojo-tags % to your page. - Include the head tag on the page, which can be configured for performance or debugging purposes. Where do I find the plugin. I did not see one shipped w/ S2 downloads? I guess after I found it, it will be answer my next question of the location of the concerning tld to use. I spend hours so far looking for it and I just end up feeling stupid not finding it. If there's another post explaining the same problem. I am sorry but I did not find it so far... Best regards and thanks for any help. D. -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tf4898788.html#a14030983 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15134394.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- RICHARD Julien, UNILOG -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15134669.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
OK Dave, for those of us who are interested in getting 2.1 working the original poster's question seems entirely relevant. Just what does the line '- include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib' mean. I cannot find any distribution or source for said plugin either. cheers, Paul B. newton.dave wrote: The docs regarding the sx prefix are for S2.1. d. --- greyshine [EMAIL PROTECTED] wrote: Hi out there, I am trying to get a little Ajax running w/ the S2. On the webpage: http://struts.apache.org/2.x/docs/ajax-tags.html it says: - include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib folder. - Add %@ taglib prefix=sx uri=/struts-dojo-tags % to your page. - Include the head tag on the page, which can be configured for performance or debugging purposes. Where do I find the plugin. I did not see one shipped w/ S2 downloads? I guess after I found it, it will be answer my next question of the location of the concerning tld to use. I spend hours so far looking for it and I just end up feeling stupid not finding it. If there's another post explaining the same problem. I am sorry but I did not find it so far... Best regards and thanks for any help. D. -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tf4898788.html#a14030983 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15134394.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Quick update, 0.43 removes any javascript errors. I think that's a bit of show-stopper for me. I still do not get a call to any action for the div. I do want to know why that is so I am going to try to track down the problem before I abandon all hope. Cheers, Paul B. paulbrickell wrote: Dave, I hope you don't think you've taken on a lifetime commitment here;-) I may be misunderstanding whats happening here, but here goes.. I have a really simple page that include the sx:head tag and an sx:div. Now I do not not see any call to the target action for the div tag. So I started looking at the page source and the template sources to see what the templates for sx:head and sx:div were up to. it appears that sx:head creates links for various resources... script language=JavaScript type=text/javascript src=/application/struts/ajax/dojoRequire.js/script link rel=stylesheet href=/application/struts/xhtml/styles.css type=text/css/ script language=JavaScript src=/application/struts/utils.js type=text/javascript/script script language=JavaScript src=/application/struts/xhtml/validation.js type=text/javascript/script script language=JavaScript src=/application/struts/css_xhtml/validation.js type=text/javascript/script None of which exists in my application. So I am guessing (never a good idea) that I need to compose these bits from the distro. You are right these components do exists in the libraries. Am I right in thinking I need to copy these into my web application in the structure required by the links in the head template? Also I get various javascript errors... 1. Could not load 'dojo.io.BrowserIO'; last tried './io/BrowserIO.js' 2. dojo.hostenv has no properties 3. djConfig.searchIds has no properties These I suspect are related to the version of dojo I am using (1.0.2 which is the latest release). The path io.BrowserIO.js for example just doesn't exists. Man I would love to get this working. It is just what my app need. Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: what the head template outputs are some links (see my earlier post for the details) to application/struts/* js and css files. So what I am trying to do is assemble the components that the head template requires and put them in the right place. It seems they are many and distributed across multiple jars. Mmm, all of the deps should be in the dojo-plugin and struts core, IIRC. Are there specific issues you're running in to? d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15136334.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
LOL. For an Englishman sometimes my English sucks. No I probably dont want errors. What I meant was that this demonstrated to me the dependency on version 0.4.x of Dojo and thats a showstopper. I really want to use 1.0.x so I am going to have to choose between Struts 2.1 and its lovely stuff for Dojo and 1.0.x and rolling my own solution with an older version of Struts. Damn, thats a shame. Cheers, Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: 0.43 removes any javascript errors. I think that's a bit of show-stopper for me. Wait, you have an actual requirement for JavaScript errors!? ;) I still do not get a call to any action for the div. You should probably post at least the JSP source for the sx:div... tag; I don't remember it anymore if I ever saw it. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15137583.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Yep, that works exactly like it says on wiki. out of curiosity just how does that automagic work? How on earth does the path /whatever/struts/css_xhtml/validation.js get resolved to a jar? Also I guess that the baseRelativePath attribute is a bit of red-herring. The restructuring between version 0.4.x and 1.0.x of dojo is pretty radical. No way they are compatible. I did just check out the source and start a build. But frankly the newer features of Dojo I am losing is a bit of a showstopper. I may well have to drop a back a version of Struts and roll my own solution. It's such a shame I would love to get all that great stuff for free. There is simply no way I can convince my employer I can contribute a solution on their time but I have to think my best solution would be to do it anyway. Thanks for all your help here, Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: it appears that sx:head creates links for various resources... script language=JavaScript type=text/javascript src=/application/struts/ajax/dojoRequire.js/script link rel=stylesheet href=/application/struts/xhtml/styles.css type=text/css/ script language=JavaScript src=/application/struts/utils.js type=text/javascript/script script language=JavaScript src=/application/struts/xhtml/validation.js type=text/javascript/script script language=JavaScript src=/application/struts/css_xhtml/validation.js type=text/javascript/script None of which exists in my application. So I am guessing (never a good idea) that I need to compose these bits from the distro. These are all in the struts-core JAR file, served statically via S2. You are right these components do exists in the libraries. Am I right in thinking I need to copy these into my web application in the structure required by the links in the head template? Nope; they should be included automagically. See below. Also I get various javascript errors... 1. Could not load 'dojo.io.BrowserIO'; last tried './io/BrowserIO.js' 2. dojo.hostenv has no properties 3. djConfig.searchIds has no properties These I suspect are related to the version of dojo I am using (1.0.2 which is the latest release). The path io.BrowserIO.js for example just doesn't exists. That's probably going to be an issue; the S2 Dojo plugin is using 0.4.mumble, which is included in the plugin JAR itself. Using a different Dojo version is probably a Bad Idea, although I haven't actually tried to know what any potential issues would be. If you're set on using S2.1 and its Dojo plugin I'd really recommend just getting the complete source via Subversion and build via Maven rather than trying to put all the pieces together manually. All the JavaScript is included in either the S2 core JAR or the Dojo plugin JAR; mixing Dojo versions is probably bad. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15136841.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Dave, I hope you don't think you've taken on a lifetime commitment here;-) I may be misunderstanding whats happening here, but here goes.. I have a really simple page that include the sx:head tag and an sx:div. Now I do not not see any call to the target action for the div tag. So I started looking at the page source and the template sources to see what the templates for sx:head and sx:div were up to. it appears that sx:head creates links for various resources... script language=JavaScript type=text/javascript src=/application/struts/ajax/dojoRequire.js/script link rel=stylesheet href=/application/struts/xhtml/styles.css type=text/css/ script language=JavaScript src=/application/struts/utils.js type=text/javascript/script script language=JavaScript src=/application/struts/xhtml/validation.js type=text/javascript/script script language=JavaScript src=/application/struts/css_xhtml/validation.js type=text/javascript/script None of which exists in my application. So I am guessing (never a good idea) that I need to compose these bits from the distro. You are right these components do exists in the libraries. Am I right in thinking I need to copy these into my web application in the structure required by the links in the head template? Also I get various javascript errors... 1. Could not load 'dojo.io.BrowserIO'; last tried './io/BrowserIO.js' 2. dojo.hostenv has no properties 3. djConfig.searchIds has no properties These I suspect are related to the version of dojo I am using (1.0.2 which is the latest release). The path io.BrowserIO.js for example just doesn't exists. Man I would love to get this working. It is just what my app need. Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: what the head template outputs are some links (see my earlier post for the details) to application/struts/* js and css files. So what I am trying to do is assemble the components that the head template requires and put them in the right place. It seems they are many and distributed across multiple jars. Mmm, all of the deps should be in the dojo-plugin and struts core, IIRC. Are there specific issues you're running in to? d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15136127.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Dave, I guess if use Dojo independantly of the S2 tags the Musachy point about ending up writing the same things all over my JSP's applies. I think if I want to do this in a grown up way the right thing to do would be to bite down hard and write some freemarker. I do REALLY want to do the right way. Thanks again for your (and Musachy's), remarkably prompt, feedback. Truly appreciated. Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: Yes, but the freemarker templates for head and div (and I guess the others too) are highly dependent on version 0.4.x of Dojo. So to make this work I would have to rewrite said templates. uhm, I may just do that. If you do, keep people posted. You can always use Dojo independent of the S2 tags, too. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15138982.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Yes, but the freemarker templates for head and div (and I guess the others too) are highly dependent on version 0.4.x of Dojo. So to make this work I would have to rewrite said templates. uhm, I may just do that. Cheers, Paul B. Musachy Barroso wrote: in 2.1 you can use your own dojo distribution by setting the baseRelativePath attr in the head tag. see http://cwiki.apache.org/WW/dojo-head.html for details. musachy On Jan 28, 2008 10:28 AM, paulbrickell [EMAIL PROTECTED] wrote: LOL. For an Englishman sometimes my English sucks. No I probably dont want errors. What I meant was that this demonstrated to me the dependency on version 0.4.x of Dojo and thats a showstopper. I really want to use 1.0.x so I am going to have to choose between Struts 2.1 and its lovely stuff for Dojo and 1.0.x and rolling my own solution with an older version of Struts. Damn, thats a shame. Cheers, Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: 0.43 removes any javascript errors. I think that's a bit of show-stopper for me. Wait, you have an actual requirement for JavaScript errors!? ;) I still do not get a call to any action for the div. You should probably post at least the JSP source for the sx:div... tag; I don't remember it anymore if I ever saw it. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15137583.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15138516.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] dojo plugin - I don't find the resources
Cant argue with that. I guess a little background on what I am up to would help. I am trying to build an application using the dojo plugin. So what I did was include a dependency on struts core 2.1.0 snapshot and the dojo-plugin 2.1.0 snapshot in my pom file added the http://people.apache.org/repo/m2-snapshot-repository repository and let maven do its thing. Then following the instructions at.. http://struts.apache.org/2.x/docs/ajax-tags.html (which are public, I guess) I tried to get my application going with a simple page using just the head and a div tags. what the head template outputs are some links (see my earlier post for the details) to application/struts/* js and css files. So what I am trying to do is assemble the components that the head template requires and put them in the right place. It seems they are many and distributed across multiple jars. I will persevere as I really want to use the components, they just fit the bill for my application perfectly. Thanks for your help so far, Paul B. newton.dave wrote: --- paulbrickell [EMAIL PROTECTED] wrote: OK Dave, for those of us who are interested in getting 2.1 working the original poster's question seems entirely relevant. Sure, but I'm not entirely clear how I'd know what version they wanted to use if they don't tell me, and since 2.1 isn't released I'll generally provide information for the currently released version, which isn't what the wiki documents. Just what does the line '- include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib' mean. I cannot find any distribution or source for said plugin either. There is no distribution for the S2.1 Dojo plugin; the builds for 2.1 are only struts-core, which isn't released. The source is available in the repository which can be retrieved via Subversion and built with Maven. Take the built JAR file and put it in WEB-INF/lib. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--dojo-plugin---I-don%27t-find-the-resources-tp14030983p15135208.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]